Problem with assigning variables of type List
peter at engcorp.com
Wed Aug 21 06:20:17 CEST 2002
Abhishek Roy wrote:
> "Fredrik Lundh" <fredrik at pythonware.com> wrote in message news:<xiu89.5146$HY3.1421847 at newsc.telia.net>...
> > ... you have to say something like "the object referred to
> > by x is passed by reference". Or alternatively, "x is passed
> > by value, and that value is a reference to an object". Just
> > calling it "pass by reference" or "pass by value" are both
> > half true and half false.
> I'm still not quite sure what that means but after reading,
> I experienced a lovely feeling of enlightenment.
> Just a nagging doubt, using the terminology in the above guide what's going
> on with:
> >>> a=[1,2,3]
> >>> a=a
> >>> a
> [1, [...], 3]
> >>> a==a
You created a recursive object, which contains a reference to itself.
Since this goes down infinitely deep, and you can't compare infinities,
I thought, I wonder whether the "1" is mathematically true. It is
certain true according to Python's rules though.
More information about the Python-list