[Python-ideas] Using * in indexes (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 14 06:16:37 CEST 2010
- Previous message: [Python-ideas] Why not break cycles with one __del__?
- Next message: [Python-ideas] Using * in indexes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I just found myself writing a method like this:
def getitem(self, index): return self.data[(Ellipsis,) + index + (slice(),)]
I would have liked to write it like this:
self.data[..., index, :]
because that would make it much easier to see what's being done. However, that won't work if index is itself a tuple of index elements.
So I'd like to be able to do this:
self.data[..., *index, :]
-- Greg
- Previous message: [Python-ideas] Why not break cycles with one __del__?
- Next message: [Python-ideas] Using * in indexes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]