[issue4024] float(0.0) singleton

Terry J. Reedy report at bugs.python.org
Sat Mar 21 00:15:02 CET 2009


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

I have 3 comments for future readers who might want to reopen.

1) This would have little effect on calculation with numpy.

2) According to sys.getrefcount, when '>>>' appears, 3.0.1 has 1200
duplicate references to 0 and 1 alone, and about 2000 to all of them. 
So so small int caching really needs to be done by the interpreter.  Are
there *any* duplicate internal references to 0.0 that would help justify
this proposal?

3) It is? (certainly was) standard in certain Fortran circles to NAME
constants as Raymond suggested.  One reason given was to ease conversion
between single and double precision.  In Python, named constants in
functions would ease conversion between, for instance, float and decimal.

----------
nosy: +tjreedy

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4024>
_______________________________________


More information about the Python-bugs-list mailing list