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

bool() always return True on cartesian_product #39447

Open
2 tasks done
user202729 opened this issue Feb 4, 2025 · 0 comments
Open
2 tasks done

bool() always return True on cartesian_product #39447

user202729 opened this issue Feb 4, 2025 · 0 comments
Labels

Comments

@user202729
Copy link
Contributor

user202729 commented Feb 4, 2025

Steps To Reproduce

sage: cartesian_product([Set([])])
The Cartesian product of ({},)
sage: cartesian_product([Set([])]).is_empty()
True
sage: bool(cartesian_product([Set([])]))
True

Expected Behavior

bool should return not self.is_empty()

Actual Behavior

it always return True

Additional Information

Basically this is caused by the __bool__ implementation of Parent. The is_empty is in Sets.CartesianProducts.ParentMethods, but putting another __bool__ there cannot override because it is below.

Environment

  • OS: Linux
  • Sage Version: latest master

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant