[issue32194] When creating list of dictionaries and updating datetime objects one by one, all values are set to last one of the list.
Dmitry Kazakov
report at bugs.python.org
Fri Dec 1 06:59:33 EST 2017
Dmitry Kazakov <waultah+py at gmail.com> added the comment:
This is not a bug in Python. Refer to this page for the explanation: https://stackoverflow.com/questions/240178/list-of-lists-changes-reflected-across-sublists-unexpectedly
Basically, [{}]*3 creates a list with three references to the same dictionary.
----------
nosy: +vaultah
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32194>
_______________________________________
More information about the Python-bugs-list
mailing list