Newbie References Question

Alex Martelli aleax at
Wed Sep 25 10:54:24 EDT 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.


More information about the Python-list mailing list