You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For methods like enumpoly_solve, stop_after = 0 is used at the C++ level but also works in pygambit, being equivalent to stop_after = None. This will be confusing for a user and should probably be removed from pygambit.
The underlying problem is in C++ we conventionally use int stopAfter = 0 to mean "no limit" - because back in the day there was no way to have a "null" argument.
Instead, what we should do is to have C++ methods take a std::optional<size_t>. That automatically guards against negative numbers, and 0 should be checked and rejected as a bad argument. If the argument is equal to nullopt_t then that means no limit.
Then in Python, we should do similarly; stop_after should always default to None if it does not. We'll always check for stop_after <= 0 as an invalid argument, and then construct the appropriate value to pass to the C++.
Activity
tturocy commentedon Aug 20, 2026
Here's a suggested line to a solution.
The underlying problem is in C++ we conventionally use int stopAfter = 0 to mean "no limit" - because back in the day there was no way to have a "null" argument.
Instead, what we should do is to have C++ methods take a
std::optional<size_t>. That automatically guards against negative numbers, and 0 should be checked and rejected as a bad argument. If the argument is equal tonullopt_tthen that means no limit.Then in Python, we should do similarly;
stop_aftershould always default toNoneif it does not. We'll always check forstop_after <= 0as an invalid argument, and then construct the appropriate value to pass to the C++.[-]stop_gap = 0 in pygambit[/-][+]stop_after = 0 in pygambit[/+]Change stop_after from int to std::optional<size_t> in C++ and reject…