[New-bugs-announce] [issue39403] Objects equal (assertEqual return True) but behave differently
wh1te r4bb1t
report at bugs.python.org
Mon Jan 20 23:51:26 EST 2020
New submission from wh1te r4bb1t <wh1te.r4bb1t at protonmail.com>:
Here is a code highlighting a very strange behavior. This has been noticed in python 3.7, 3.8 and 3.9.0a2
def function(input_list, a='x'):
[input_list[i].append(a) for i in range(len(input_list))]
return input_list
list1 = [[0], [0], [0]]
list2 = [[0]] * 3
list1 == list2 # return True
function(list1) # return [[0, 'x'], [0, 'x'], [0, 'x']]
function(list2) # return [[0, 'x', 'x', 'x'], [0, 'x', 'x', 'x'], [0, 'x', 'x', 'x']]
list1 == list2 # return false
----------
messages: 360351
nosy: wh1te r4bb1t
priority: normal
severity: normal
status: open
title: Objects equal (assertEqual return True) but behave differently
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39403>
_______________________________________
More information about the New-bugs-announce
mailing list