[New-bugs-announce] [issue38245] Why am I getting inconsistent results in this simple List assignment?

Srinivasan Samuel report at bugs.python.org
Sat Sep 21 13:06:30 EDT 2019


New submission from Srinivasan Samuel <creatorsss at yahoo.com>:

Here is the my direct cut & paste from my Python 3.7.3 Shell
>>> C = 2*[[]]
>>> C
[[], []]
>>> 
>>> M = [[],[]]
>>> M
[[], []]
>>> 
>>> C == M
True
>>> 
>>> M[0].append(5)
>>> M
[[5], []]
>>> 
>>> C[0].append(5)
>>> C
[[5], [5]]
>>> 
>>> C == M
False
>>>

----------
messages: 352945
nosy: pysolo
priority: normal
severity: normal
status: open
title: Why am I getting inconsistent results in this simple List assignment?
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38245>
_______________________________________


More information about the New-bugs-announce mailing list