typing with args of global functions (except multiplication, element)#910
Open
typing with args of global functions (except multiplication, element)#910
Conversation
IgnaceBleukx
requested changes
Apr 7, 2026
Collaborator
IgnaceBleukx
left a comment
There was a problem hiding this comment.
Yes, the xxx_listlike helper functions make a lot of sense!
I suppose we'll update the .value() funcs of Operator and GlobalConstraints in future PRs in a similar style?
One blocking comment on the addition in __pow__, otherwise looks good to go
| raise TypeError("Power operator: modulo not supported") | ||
| if not isinstance(other, (int, np.integer)): | ||
| raise TypeError(f"Power operator requires a constant integer exponent, not: {other}") | ||
| if other == 0: |
Collaborator
There was a problem hiding this comment.
We will remove user vars with this enabled
| return -arg, [] | ||
|
|
||
| _abs = intvar(*self.get_bounds()) | ||
| _abs = intvar(*self.get_bounds()) # not just lb,ub, see implementation |
Collaborator
There was a problem hiding this comment.
"Not just lb,ub of arg"?
| r = intvar(*get_bounds(x % y)) # remainder | ||
| _div = intvar(*self.get_bounds()) | ||
| return _div, safen + [(x == (y * _div) + r), abs(r) < abs(y), abs(y) * abs(_div) <= abs(x)] | ||
| defining.append(Comparison("==", x, (y * _div) + r)) |
Collaborator
There was a problem hiding this comment.
Just checking: this explicit Comparsion consruct is becase __eq__ is not typed, right?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
skipped multiplication because of a float test that needs to be rewritten first
element because I expect some hard-to-type multidim related things that might be revised in #444 anyway