A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-November/050066.html below:

[Python-Dev] Constructor bug

[Python-Dev] Constructor bug [Python-Dev] Constructor bugNick Coghlan ncoghlan at iinet.net.au
Mon Nov 22 10:18:20 CET 2004
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
More information about the Python-Dev mailing list

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