[issue3439] create a numbits() method for int and long types

Terry J. Reedy report at bugs.python.org
Tue Oct 14 19:09:33 CEST 2008

Terry J. Reedy <tjreedy at udel.edu> added the comment:

I consider .numbits to be an internal property of ints and would prefer
it accessed that way.  To me, this sort of thing is what property() is for.

Guido has said that the nuisance of tacking on otherwise unnecessary
empty parens is a warning to the user that getting the answer might take
a long time.  

Another tack is to notice that numbits is the length of the bit sequence
representation of an int (excepting 0) and give ints a .__len__ method
;-).  I would not expect that suggestion to fly very far, though.

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list