Binding a variable?

Mike Meyer mwm at mired.org
Fri Oct 21 13:33:18 EDT 2005


Paul Dale <pd at traxon.com> writes:

> Hi everyone,
>
> Is it possible to bind a list member or variable to a variable such that
>
> temp = 5
>
> list = [ temp ]
>
> temp == 6
>
> list
>
> would show
>
> list = [ 6 ]

No. You need to either put a mutable in the list, or subclass list so
that indexing gets the value, looks it up in the appropriate
namespace, and returns that value.

           <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list