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
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
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
3 matches
Mail list logo