[[...]]

Richard Brodie R.Brodie at rl.ac.uk
Fri Mar 17 15:42:48 CET 2000


"Michal Bozon" <bozon at natur.cuni.cz> wrote in message
news:Pine.OSF.4.10.10003171444370.30096-100000 at prfdec.natur.cuni.cz...
> # Hi.
> #
> # I tried following:
>
> >>> a = []
> >>> a.append(a)
> >>> a
> [[...]]
>
> # What does it mean?

a = [a] = [[a]] = [[[a]]] = [[[[a]]]]]
a is a list whose only element is a list whose only element is a list whose only element is...

You can do a trick with slicing to do what I think you expect.
>>> a=[]
>>> a.append(a[:])
>>> a
[[]]







More information about the Python-list mailing list