You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2018-11-29.06:41:01.471>created_at=<Date2018-11-28.17:05:42.662>labels= ['invalid', 'type-bug', '3.7']
title='Populating instances of class automatically'updated_at=<Date2018-11-29.06:41:01.470>user='https://bugs.python.org/Daugeras'
Hello, I am not sure it is a bug, but it is a very strange behavior of Python, which I do not understand.
I created a class (mainly a structure) and instantiated an object of this class in a first function (Object 1). The function populates Object 1.
In another function, I instantiate another object of the same class (Object 2) , and Object 2 is automatically populated with the data of Object 1. Note than Object 1 and Object 2 have different memory adresses.
This behavior is very strange. Is it normal for Python or is it a Bug ?
Indeed you where right, this is not a bug.
The link you provided did solve my problem.
I declared classes with attributes as strings, lists, etc... and indeed it was the reason for the issue.
I changed it to instantiate the attributes in the __init__ method of the class, and it solved the problems.
Thanks again !!
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: