Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Peter Pearson Newsgroups: comp.lang.python Subject: Re: list storing variables Date: 23 Feb 2015 17:35:40 GMT Lines: 34 Message-ID: References: <54eb2357$0$3011$426a74cc@news.free.fr> X-Trace: individual.net CenJeVaC+rb0TrKQVVi7wgyCLjyHcwZtW7enIZJjda0drAXYTZ Cancel-Lock: sha1:c7NHBsM5zAZPnUGtt+e5s/EOl5M= User-Agent: slrn/pre1.0.0-18 (Linux) Xref: csiph.com comp.lang.python:86247 On Mon, 23 Feb 2015 13:55:47 +0100, ast wrote: > hi > >>>> a = 2; b = 5 >>>> Li = [a, b] >>>> >>>> Li > [2, 5] >>>> a=3 >>>> Li > [2, 5] >>>> > > Ok, a change in a or b doesn't impact Li. This works as expected > > Is there a way to define a container object able to store some variables > so that a change of a variable make a change in this object content ? > > I dont need this feature. It is just something I am thinking about. > > In C language, there is &A for address of A The word "variable" brings implications and assumptions that get people into trouble in Python. Python doesn't have variables. It has objects, and you can assign names to objects -- like sticky notes, as someone in this newsgroup helpfully pointed out long ago. This way of thinking is significantly different from the familiar "variable" mind-set of C, but looks similar enough to produce some confusion. For me, the sticky-note analogy helped a lot, and in a few days many things made more sense. -- To email me, substitute nowhere->runbox, invalid->com.