On 2006-08-15, Chaos <[EMAIL PROTECTED]> wrote: > 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?
If you store an item in a one-element list, you can use the list like a reference, but it's not syntactically transparent. >>> x = [1] >>> y = x Now x and y refer to the same list. Now you can change the elements in the list through y. >>> y[0] += 1 >>> x [2] >>> y [2] -- Neil Cerutti Sermon Outline: I. Delineate your fear II. Disown your fear III. Displace your rear --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list