[Python-Dev] Indexing builtin sequences with objects which supply __int__

Todd Miller jmiller@stsci.edu
Thu, 20 Jun 2002 16:29:18 -0400


There has been some recent interest in the Numeric/numarray community 
for using array objects as indices
for builtin sequences.  I know this has come up before, but to make 
myself clear, the basic idea is to make the
following work:

class C:
    def __int__(self):
          return 5

object = C()

l = "Another feature..."

print l[object]
"h"

Are there any plans (or interest) for developing Python in this direction?

Todd