Newbie References Question

Alex Martelli aleax at aleax.it
Wed Sep 25 16:54:24 CEST 2002


Guy Rabiller wrote:

> Hi,
> 
> let say I have:
> i1 = 1
        ...
> Textualy, how if I want that p[0] refere to the 'i1' container, and not to

There is no 'i1' CONTAINER.  'i1' is just a NAME.  That's what variables
are in Python -- they don't contain anything: they're like post-it labels,
attached to an object or to another.

> the refererence it contains ?
> 
> What I want is that if now I set:
> i1 = 4
> that automaticaly:
> p -> [4,2]
> and not keeping [1,2]

There is no way to do exactly what you require.  There may be ways to
do roughly-equivalent things, if you help us help you by explaining
your application context a bit more widely.


Alex




More information about the Python-list mailing list