Oliver Walczak wrote: > So, is it a bug or a feature? In my eyes this behaviour is not what the > programmer has got to expect. Who knows whats happening there and can > explain me if it makes any sense? The output is exactly what I expected: c1, before: d1= {'key': 'value'} d2= {'key': 'value'} c1, after: d1= {'key': 'value2'} d2= {'key': 'value2'} c2: d1= {'key': 'value2'} d2= {'key': 'value'} Exactly what do you believe is mysterious here? c2 sees the modified version of the class variable (d1), and sees a fresh copy of the instance variable (d2). Please make you question more explicit. Regards, Nick. -- Nick Coghlan | Brisbane, Australia Email: ncoghlan at email.com | Mobile: +61 409 573 268
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4