[Python-Dev] n.numbits: method or property?

Victor Stinner victor.stinner at haypocalc.com
Wed Nov 12 01:37:17 CET 2008


> n.numbits: method or property?

Fredrik Johansson and me agree to use a property.

My last patch (numbits-4.patch) implement numbits as a property. Examples:
>>> (1023).numbits
10
>>> x=1023L; x.numbits
10L
>>> x=2**(2**10); x.numbits
1025L
>>> x=2**(2**10); x.numbits.numbits   # combo!
11L

Victor


More information about the Python-Dev mailing list