This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author arigo
Recipients arigo, mark.dickinson, serhiy.storchaka, zach.ware
Date 2013-08-17.16:08:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1376755701.77.0.859829649998.issue18712@psf.upfronthosting.co.za>
In-reply-to
Content
This may have been the most recent discussion of this idea (as far as I can tell):
http://mail.python.org/pipermail//python-ideas/2012-August/016036.html

Basically, it seems to be still unresolved in the trunk Python; sorry, I thought by now it would have been resolved e.g. by the addition of a method on types or a function in the operator module.  In the absence of either, you need either to simulate its behavior by doing this:

    for t in type(a).__mro__:
        if '__index__' in t.__dict__:
            return t.__dict__['__index__'](a)

Or you can piggyback on an unrelated call that simply causes the C-level PyNumber_Index() to be called:

    return range(a).stop
History
Date User Action Args
2013-08-17 16:08:21arigosetrecipients: + arigo, mark.dickinson, zach.ware, serhiy.storchaka
2013-08-17 16:08:21arigosetmessageid: <1376755701.77.0.859829649998.issue18712@psf.upfronthosting.co.za>
2013-08-17 16:08:21arigolinkissue18712 messages
2013-08-17 16:08:21arigocreate