[Python-Dev] [Python-checkins] r64424 - in python/trunk:Include/object.h Lib/test/test_sys.py Misc/NEWSObjects/intobject.c Objects/longobject.c Objects/typeobject.cPython/bltinmodule.c

Nick Coghlan ncoghlan at gmail.com
Thu Jun 26 16:19:10 CEST 2008

Raymond Hettinger wrote:
>> and I'm definitely not keen on the fact that it's overloaded on the
>> hex/bin/oct builtins.
>> Can't it be a separate function? 
> Simplicity.  bin/oct/hex have the job of giving alternate base 
> representations for numbers.
> Nothing is gained by adding a duplicate set of functions in the math 
> module for float inputs.

I'd place additional requirements on using bin/oct/hex for this:

1. The new feature must be available to floating point types other than 
float (such as Decimal) in both 2.6 and 3.0 (keeping in mind that 3.0 
does not support __bin__, __hex__, or __oct__ methods - it uses only 
__index__ to implement bin(), hex() and oct()

2. Other classes (such as Decimal) should be able to leverage the 
formatting functionality provided for floats.

If it was just a new method on float objects or a new function in the 
math module, neither of those additional requirements would apply - I 
would be completely fine with the function only working for actual float 

However, in either case, I think this also runs afoul of the "we're in 
beta" argument - yes, it's a nice feature, but I don't think it's one 
that will cause any great dramas if users don't get their hands on it 
until 2.7/3.1.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list