Skip to content

Conversation

@hbierlee
Copy link
Contributor

@hbierlee hbierlee commented Sep 30, 2025

Fixes #654. It is over-explained in the linked issue, but the discrepancy is simply this:

>>> cp.sum(1,2)
3
>>> sum(1,2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable

Allowing cp.sum(1,2) was I think accidentally introduced by #111. I believe we should follow Python's design for all builtins, but this is a breaking change, so perhaps needs to be moved to cpmpy 0.10 / stable.

This is in line with the Python's `builtins.sum`
@hbierlee hbierlee requested a review from tias September 30, 2025 11:28
@tias tias added this to the v.0.9.28 milestone Oct 6, 2025
@tias tias added the for stable label Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sum over single boolvar

3 participants