Chaos a écrit : > Is It possible to have reference variables like in PHP > > ex. > > <?php > > $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 refering to objects). You may achieve same result using an object as a namespace, like this: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> class Dummy(object) : pass ... >>> x=Dummy() >>> x.val = 1 >>> y = x <-- here x and y refer to *same* Dummy object >>> y.val += 1 >>> x.val 2 >>> y.val 2 A+ Laurent. -- http://mail.python.org/mailman/listinfo/python-list