[[...]]

Adrian Eyre a.eyre at optichrome.com
Fri Mar 17 09:13:49 EST 2000


> >>> a = []
> >>> a.append(a)
> >>> a
> [[...]]
> 
> # What does it mean?

Since 'a' contains a reference to 'a', which contains a reference to 'a',
et cetera, the python __repr__ string would be infinite, so '...' is used
to indicate this fact.

> # Then I tried:
> 
> >>> a[0].append(a)
> [[...], [...]]
> 
> 
> # And now I understand completely nothing

Same deal, except 'a[0]' which *is* 'a' contains 2 references to 'a', etc.

So you can do:

>>> a[0][0][0][0][0][0][0][0][0][0][0][0][0][0].....
[[...]]

-----------------------------------------------------------------
Adrian Eyre <a.eyre at optichrome.com> - http://www.optichrome.com 





More information about the Python-list mailing list