#31717 closed defect (fixed)

Empty families should be false

Reported by: mkoeppe Owned by:
Priority: major Milestone: sage-9.4
Component: combinatorics Keywords:
Cc: tscrim Merged in:
Authors: Travis Scrimshaw Reviewers: Matthias Koeppe
Report Upstream: N/A Work issues:
Branch: 42abda7 (Commits, GitHub, GitLab) Commit: 42abda7c927e2db4378cdaf4af27315c6669d62b
Dependencies: Stopgaps:

Status badges


sage: Family([])                                                                                                                            
Family ()
sage: bool(_)                                                                                                                               

Compare with:

sage: bool(dict())                                                                                                                          

Change History (7)

comment:1 Changed 14 months ago by tscrim

  • Authors set to Travis Scrimshaw
  • Branch set to public/sets/trivial_family_bool-31717
  • Commit set to cbbef90cc8caacb6bafbe2c0cb32d40bfe5a4f4b
  • Status changed from new to needs_review

I added the simple __bool__ check to the appropriate class:

sage: type(Family([]))
<class 'sage.sets.family.TrivialFamily_with_category'>
sage: type(Family({}))
<class 'sage.sets.family.FiniteFamily_with_category'>

New commits:

cbbef90Adding a __bool__ to trivial family.

comment:2 Changed 14 months ago by mkoeppe

Shouldn't there also be a change for FiniteFamily?

comment:3 Changed 14 months ago by git

  • Commit changed from cbbef90cc8caacb6bafbe2c0cb32d40bfe5a4f4b to 42abda7c927e2db4378cdaf4af27315c6669d62b

Branch pushed to git repo; I updated commit sha1. New commits:

42abda7Adding __bool__ for other families.

comment:4 Changed 14 months ago by tscrim

Indeed, there should be. I also added one for LazyFamily.

comment:5 Changed 14 months ago by mkoeppe

  • Reviewers set to Matthias Koeppe
  • Status changed from needs_review to positive_review

This works well, thanks a lot

comment:6 Changed 14 months ago by tscrim

No problem. Thanks for the review.

comment:7 Changed 12 months ago by vbraun

  • Branch changed from public/sets/trivial_family_bool-31717 to 42abda7c927e2db4378cdaf4af27315c6669d62b
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.