[issue21943] To duplicate a list has biyective properties, not inyective ones

Toni Diaz report at bugs.python.org
Wed Jul 9 11:11:52 CEST 2014


New submission from Toni Diaz:

Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a=['dog']
>>> b=a
>>> a
['dog']
>>> b
['dog']
>>> b.remove('dog')
>>> a
[]
>>> b
[]
>>>

When defining a list from another (b=a), in my opinion, I expect that all you do to one doesn't affect to the other one.
However, with the commands .remove & .append I don't see that (the definition b=a is bijective).
Should it work this way?

Thanks

----------
components: Demos and Tools
messages: 222606
nosy: Toni Diaz
priority: normal
severity: normal
status: open
title: To duplicate a list has biyective properties, not inyective ones
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21943>
_______________________________________


More information about the Python-bugs-list mailing list