[Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
Alex Martelli
aleaxit at gmail.com
Fri Feb 10 02:26:45 CET 2006
More information about the Python-Dev mailing list
Fri Feb 10 02:26:45 CET 2006
- Previous message: [Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
- Next message: [Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2/9/06, Travis E. Oliphant <oliphant.travis at ieee.org> wrote: ... > The patch adds a new API function int PyObject_AsIndex(obj). > > This was not specifically in the PEP but probably should be. The name > could also be PyNumber_AsIndex(obj) but I was following the nb_nonzero > slot example to help write the code. Shouldn't that new API function (whatever its name) also be somehow exposed for easy access from Python code? I realize new builtins are unpopular, so a builtin 'asindex' might not be appropriate, but perhaps operator.asindex might be. My main point is that I don't think we want every Python-coded sequence to have to call x.__index__() instead. Alex
- Previous message: [Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
- Next message: [Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list