Re: Reference Variables In Python Like Those In PHP

2006-08-16 Thread Laurent Pointal
Chaos a écrit : > Is It possible to have reference variables like in PHP > > ex. > > > $x = 1; > $y =& $x; > > $y += 1; > > echo $x; > echo "\n" > echo $y; > > ?> > > This would show > > 2 > 2 > > Is this available in python? See other replies (ie. in Python all variables are names refer

Re: Reference Variables In Python Like Those In PHP

2006-08-15 Thread Fredrik Lundh
Luke Plant wrote: > You should note that, to a nearest equivalent, all variables are > reference variables in Python. The difference is in what assignment > does - += in Python does an assignment of a new object for immutable > objects. For mutable objects like lists, += does an in place > mod

Re: Reference Variables In Python Like Those In PHP

2006-08-15 Thread Luke Plant
Chaos wrote: > Is It possible to have reference variables like in PHP ... > Is this available in python? You should note that, to a nearest equivalent, all variables are reference variables in Python. The difference is in what assignment does - += in Python does an assignment of a new object f

Re: Reference Variables In Python Like Those In PHP

2006-08-15 Thread Neil Cerutti
On 2006-08-15, Chaos <[EMAIL PROTECTED]> wrote: > Is It possible to have reference variables like in PHP > > ex. > > > $x = 1; > $y =& $x; > > $y += 1; > > echo $x; > echo "\n" > echo $y; > > ?> > > This would show > > 2 > 2 > > Is this available in python? If you store an item in a one-element li

Re: Reference Variables In Python Like Those In PHP

2006-08-15 Thread Terry Reedy
"Chaos" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is It possible to have reference variables like in PHP > $x = 1; > $y =& $x; > $y += 1; > echo $x; > echo "\n" > echo $y; > ?> > > This would show > 2 > 2 > Is this available in python? No, in the literal meaning of your ques

Reference Variables In Python Like Those In PHP

2006-08-15 Thread Chaos
Is It possible to have reference variables like in PHP ex. This would show 2 2 Is this available in python? -- http://mail.python.org/mailman/listinfo/python-list