[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

Eric Smith eric+python-dev at trueblade.com
Thu Jun 26 14:23:49 CEST 2008


Actually, after saying I was opposed to __bin__ in 2.6, I said:
"Instead, I think the approach used in 3.0 (r64451) should be used 
instead. That is, if this feature exist at all. I'm -0 on adding 
bin(), etc. to floats."
My last sentence is a little unclear. I meant I'm -0 on adding floats 
as arguments to bin(), oct(), and hex(). Primarily because a) it's not 
extensible in 3.0, and b) I find it surprising, in that I'd expect those 
functions to throw an error for non-integral types (that is, those not 
having __index__). I think adding a "float_as_binary_expression()" 
(with a better name) in some module would get the functionality you 
seek. What is gained by adding this to bin() and friends?
Raymond Hettinger wrote:
> From: "Guido van Rossum" <guido at python.org>
>> I don't care about the details of the patch until we have agreement
>> about which form the feature should take. We don't have that agreement
>> yet.
>> Updated to the patch to address everyone's review comments:
> http://bugs.python.org/file10742/float8.diff
>> * Alexander Belopolsky requested exponential notation instead of 
> potentially very long strings of bits. Done
>> * Alexander Belopolsky requested true mathematical radix 2 
> representation of a float rather than its 64-bit memory layout. Done
>> * Antoine Pitrou requested that hex() and oct() be supported as well as 
> bin(). Terry J. Reedy also requested support for hex(). Done.
>> * Alexander Belopolsky and Alexandre Vassalotti requested that the 
> output be a two-way street -- something that can be round-tripped 
> through eval(). Done.
>> * Amaury Forgeot d'Arc requested that the implementation not manipulate 
> C strings inplace. Fixed -- used PyUnicode_FromFormat() instead.
>> * Amaury Forgeot d'Arc requested that tests should check if negative 
> numbers have the same representation as their absolute value. Done.
>> * Mark Dickinson requested sign preserving output for bin(-0.0). We 
> couldn't find a clean way to do this without a special cased output format.
>> * Mark Dickinson reviewed the NaN/Inf handling. Done.
>> * Eric Smith requested that the routine be attached to 
> _PyFloat_to_base() instead of attaching to __bin__, __oct__, and 
> __hex__. Done.
>> * Guido requested that the docs be updated. Done.
>> * Guido requested that the globally visible C API function name be 
> prefixed with _Py. Done.
>> * Mark Dickinson requested normalizing output to start with a 1 so that 
> nearby values have similar reprs. Done.
>>> Raymond
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/eric%2Bpython-dev%40trueblade.com 
>>


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /