Floating point bug?
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Feb 14 12:59:05 EST 2008
En Thu, 14 Feb 2008 15:22:41 -0200, Jeff Schwab <jeff at schwabcenter.com>
escribió:
> Christian Heimes wrote:
>> No, print invokes the tp_print slot of the float type. Some core types
>> have a special handler for print. The tp_print slot is not available
>> from Python code and most people don't know about it. :]
>
> Why does print use the tp_print slot, rather than str()? Are the two
> effectively redundant? If (non-repr) string representations are
> frequently needed for a given type, could str() be implemented as a
> reference to tp_slot, via a C-language extension?
As a side note, the print statement has FIVE related opcodes. Looks like
printing has been considered a very important operation...
--
Gabriel Genellina
More information about the Python-list
mailing list