Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Breaking Python None Semantics #290

Closed
smythi93 opened this issue Jan 29, 2025 · 3 comments
Closed

BUG: Breaking Python None Semantics #290

smythi93 opened this issue Jan 29, 2025 · 3 comments
Assignees
Labels
prio: medium Medium priority issue scope: bug Something isn't working status: awaiting integration Task is addressed in a branch

Comments

@smythi93
Copy link
Collaborator

In src/fandango/constraints/base.py line 179 contd is a None check, which breaks Python's semantics.
Also, this perfect fitness looks extremely sus...

@smythi93 smythi93 added prio: medium Medium priority issue scope: bug Something isn't working labels Jan 29, 2025
@andreas-zeller
Copy link
Collaborator

I think this is there to accomodate constraints that simply call print() (or otherwise produce no value). Hence, ignoring None as a return value is not a bad thing.

@smythi93
Copy link
Collaborator Author

smythi93 commented Feb 9, 2025

Then the printing should return evaluate to True for constraints, otherwise this would not be consistent with Python's semantic, e.g., things like
x = None
x and True

Would be completely skipped but should definitely evaluate to False.

@andreas-zeller
Copy link
Collaborator

My biggest concern would be functions like re.match() (which return None if there is no match), which could well be part of a constraint. To accommodate print() statements, we can suggest simply using print(x) or True.

I have commented ignoring None values out for now, so this is addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: medium Medium priority issue scope: bug Something isn't working status: awaiting integration Task is addressed in a branch
Projects
None yet
Development

No branches or pull requests

3 participants