[issue42883] __init__ function may incur an incorrect behavior if passing a list as a parameter and set its default value as empty

2021-01-10 Thread Haoyang
Haoyang added the comment: Thanks! -- ___ Python tracker <https://bugs.python.org/issue42883> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42883] __init__ function may incur an incorrect behavior if passing a list as a parameter and set its default value as empty

2021-01-10 Thread Haoyang
New submission from Haoyang : Here is the bug-triggered code snippet in the file uploaded class A: def __init__(self, b=[]): print('b = ', b) self.a = b for i in range(3): a = A() a.a.append(1) print(a.a) It seems that when I pass a list "