[Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
Jim Jewett
jimjjewett at gmail.com
Mon Feb 13 22:16:17 CET 2006
Travis wrote:
> The patch adds a new API function int PyObject_AsIndex(obj)
How did you decide between int and long?
Why not ssize_t?
Also, if index is being added as a builtin, should the failure
result be changed? I'm thinking that this may become a
replacement for isinstance(val, (int, long)). If so, it might
be nice not to raise errors, or at least to raise a more
specific subclass. (Catching a TypeError and then
checking the message string ... does not seem clean.)
-jJ
More information about the Python-Dev
mailing list