Indexing list of lists

John J. Lee jjl at pobox.com
Thu Sep 18 08:30:36 EDT 2003


hildegarde_roth at yahoo.de (Hilde Roth) writes:
[...]
> of doing right now. So yes I would allow both: within each ";" separated
> index group, the current syntax (whatever it is) would apply.

Ain't going to happen.  If you want that kind of thing without forking
your own version of Python, Numeric/numarray is the closest you'll get
(no special syntax, but lots of useful functions and 'ufuncs').


[...]
> While we are at it, I also don't understand why sequences can't be
> used as indices. Why not, say, l[[2,3]] or l[(2, 3)]? Why a special 
[...]

I'd guess you can subclass numarray's arrays and get this behaviour.
Or simply write your own sequence object and override __getitem__.

I'd guess it's highly unlikely ever to be part of the standard
sequence protocol, though.


John




More information about the Python-list mailing list