Floating point bug?

Christian Heimes lists at cheimes.de
Thu Feb 14 04:20:41 EST 2008


Dennis Lee Bieber wrote:
> 	What's wrong with just
> 
> 	str(0.3)
> 
> that's what "print" invokes, whereas the interpreter prompt is using 
> 
> 	repr(0.3)
> 

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. :]

Christian




More information about the Python-list mailing list