nested lists - utter newbie

rahoool at gmail.com rahoool at gmail.com
Fri Jul 1 04:25:44 EDT 2005


Hi,
why is this possible -
>>>b = [1,2,3]
>>>b[2] = b
>>>b
[1,2,[...]]
>>>b[2]
[1,2,[...]]
>>>b[2][2][2][2][2]
[1,2,[...]]

but this is not -
>>>x = [1,2,x]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'x' is not defined

thanks
r_a_h_o_o_l




More information about the Python-list mailing list