[Python-3000] [Python-3000-checkins] r62269 - in python/branches/py3k: Lib/test/test_getargs2.py Objects/abstract.c Python/getargs.c

Amaury Forgeot d'Arc amauryfa at gmail.com
Thu Apr 10 19:42:53 CEST 2008


Hello,

> Log:
> Issue 2440: fix the handling of %n in Python/getargs.c's convertsimple(),
> extend Objects/abstract.c's PyNumber_Index() to accept PyObjects that have nb_int slots,
> and update test_getargs2 to test that an exception is thrown when __int__() returns a non-int object.

Does this mean that floats can now be used as list indexes?
Preventing this was the motivation for introducing the nb_index slot.

from http://www.python.org/dev/peps/pep-0357 ::

    The biggest example of why using nb_int would be a bad
    thing is that float objects already define the nb_int method, but
    float objects *should not* be used as indexes in a sequence.

-- 
Amaury Forgeot d'Arc


More information about the Python-3000 mailing list