Skip to content

stop_after = 0 in pygambit #1067

Closed

Description

@rahulsavani

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.

Activity

  1. added
    c++Items which involve writing in C++
    on Aug 20, 2026
  2. added this to the gambit-17.0.0.beta.1 milestone on Aug 20, 2026
  3. tturocy commented on Aug 20, 2026

    @tturocy
    Member

    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 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++.

  4. changed the title [-]stop_gap = 0 in pygambit[/-] [+]stop_after = 0 in pygambit[/+] on Aug 20, 2026
  5. added a commit that references this issue on Aug 21, 2026
    5b5c19b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

c++Items which involve writing in C++pythonItems which involve coding in Python

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions