[Python-ideas] fancy indexing

Sturla Molden sturla at molden.no
Tue Jul 20 22:15:29 CEST 2010

> [changing the subject; was: 'where' statement in Python?]

> a[[x]] = y
> y = a[[x]]
> which call __setitems__ and __getitems__ respectively. This makes it clear
> that something different is going on and eliminates the ambiguity for
> dicts.

Or use the * operator used to expand tuples for fucntion calls:

a[*x] = y
y = a[*x]

analogous to foobar(*x). The intent would be the same.


More information about the Python-ideas mailing list