[issue42003] After changing to list or tuple, will the original parameter change?

foxpython_2020 report at bugs.python.org
Sat Oct 10 19:54:23 EDT 2020


New submission from foxpython_2020 <foxtable at qq.com>:

c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))
print("1:",c) # right: {'one': 1, 'two': 2, 'three': 3}

b= zip(['one', 'two', 'three'], [1, 2, 3])
a= list(b) #Because of this line of code, the result is different
print("2:",dict(b)) #wrong: {}

b= zip(['one', 'two', 'three'], [1, 2, 3])
a= tuple(b) #Because of this line of code, the result is different
print("2:",dict(b)) #wrong: {}

----------
messages: 378417
nosy: foxpython_2020
priority: normal
severity: normal
status: open
title: After changing to list or tuple, will the original parameter change?

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


More information about the Python-bugs-list mailing list