#32148 closed enhancement (fixed)

change '__len__' method of propositional formula to 'length'

Reported by: Dave Morris Owned by:
Priority: major Milestone: sage-9.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:

Status badges

Description (last modified by Dave Morris)

#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 Dave Morris

Branch: public/32148

comment:2 Changed 19 months ago by Dave Morris

Commit: 551f2cc0e04bdb4ed22edfc1541a705c4c6d6715
Status: newneeds_review

New commits:

551f2cctrac 32148 length of propositional formula

comment:3 Changed 19 months ago by Travis Scrimshaw

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 git

Commit: 551f2cc0e04bdb4ed22edfc1541a705c4c6d671559cc054aed61866b2fbdfd72b7d5c9d1405956d3

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

59cc054do not deprecate __len__

comment:5 Changed 19 months ago by Dave Morris

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 Travis Scrimshaw

Reviewers: Travis Scrimshaw
Status: needs_reviewpositive_review

Thank you.

comment:7 Changed 19 months ago by Dave Morris

Thanks!

comment:8 Changed 18 months ago by Volker Braun

Branch: public/3214859cc054aed61866b2fbdfd72b7d5c9d1405956d3
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.