Opened 19 months ago
Closed 18 months ago
#32148 closed enhancement (fixed)
change '__len__' method of propositional formula to 'length'
Reported by:  Dave Morris  Owned by:  

Priority:  major  Milestone:  sage9.4 
Component:  symbolics  Keywords:  boolean formula, len, length 
Cc:  Merged in:  
Authors:  Dave Morris  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  59cc054 (Commits, GitHub, GitLab)  Commit:  59cc054aed61866b2fbdfd72b7d5c9d1405956d3 
Dependencies:  Stopgaps: 
Description (last modified by )
#28053 added a __len__
method to propositional formulas, so that len(f)
would return the length of the formula. However, it was pointed out in #29738 that only containers should have a len
. So the method should be renamed to length
.
sage: f = propcalc.formula("a > b") sage: f.length() 3
For now, __len__
is being retained as an alias.
Change History (8)
comment:1 Changed 19 months ago by
Branch:  → public/32148 

comment:2 Changed 19 months ago by
Commit:  → 551f2cc0e04bdb4ed22edfc1541a705c4c6d6715 

Status:  new → needs_review 
comment:3 Changed 19 months ago by
I am fine with everything except deprecating this as a __len__
. I think we should take a more incremental approach here and just add the alias, but leave it to #29738 once more concrete decisions have been reached before deprecating this behavior.
comment:4 Changed 19 months ago by
Commit:  551f2cc0e04bdb4ed22edfc1541a705c4c6d6715 → 59cc054aed61866b2fbdfd72b7d5c9d1405956d3 

Branch pushed to git repo; I updated commit sha1. New commits:
59cc054  do not deprecate __len__

comment:5 Changed 19 months ago by
Description:  modified (diff) 

Thanks for looking at this. I'm sure this feature is rarely used, so postponing the deprecation is fine with me.
comment:6 Changed 19 months ago by
Reviewers:  → Travis Scrimshaw 

Status:  needs_review → positive_review 
Thank you.
comment:8 Changed 18 months ago by
Branch:  public/32148 → 59cc054aed61866b2fbdfd72b7d5c9d1405956d3 

Resolution:  → fixed 
Status:  positive_review → closed 
New commits:
trac 32148 length of propositional formula