[web2py] Re: Strange behaviour when appending on lists

2010-01-12 Thread Benigno
Thank you guys. On Jan 11, 9:25 pm, Thadeus Burgess wrote: > It is because pv is a pointer to the memory that holds its list. > > When you append pv to val, your appending the *reference* to pv. > > So whenever you update pv, all references to pv also reflect these changes. > > The reason that sl

Re: [web2py] Re: Strange behaviour when appending on lists

2010-01-11 Thread Thadeus Burgess
It is because pv is a pointer to the memory that holds its list. When you append pv to val, your appending the *reference* to pv. So whenever you update pv, all references to pv also reflect these changes. The reason that slicing pv with [:] works is because you are making a copy of pv, and appe

[web2py] Re: Strange behaviour when appending on lists

2010-01-11 Thread DenesL
This behaviour is explained in Python's documentation under "Language reference", topic 3.1 "Objects, values and types" (in 2.5.4): "Some objects contain references to other objects; these are called containers. Examples of containers are tuples, lists and dictionaries. The references are part of