The newly introduced trunc() and round() have the following odd behavior:

$ ./python
Python 3.0x (py3k, Aug 23 2007, 17:15:22)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> trunc(3.14)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: type float doesn't define __trunc__ method
[36040 refs]
>>> 3.14.__trunc__
<built-in method __trunc__ of float object at 0x8255244>
[36230 refs]
>>> trunc(3.14)
3
[36230 refs]
>>>

It looks like builtin_trunc() is failing at the call to
_PyType_Lookup(), which must be returning NULL to get the above
behavior. I'm not sure what's causing this; perhaps someone more
experienced than me has an idea?

Keir
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to