__getitem__ and arguments
sav at ulmen.mv.ru
Sat Jul 19 15:34:10 CEST 2003
??>>>> a[1, 2, 3]
K> For __getitem__() the arguments become a tuple. I can't seem to find
K> this in the language spec. Can anybody explain this to me?
Python doesn't have multidimension arrays. It has only sequences and dicts
which consist from values indexed by keys. When you write a[1,2,3] python
always see a[key] where key=(1,2,3). Tuples created automaticly where
neccessary. Try "return 1, 2, 3" or "a,b,c = 1, 2, 3" statements.
With best regards, Alexander Semenov.
More information about the Python-list