[issue16372] Initialization strange behavior

2012-10-31 Thread Wojciech Danilo
Wojciech Danilo added the comment: Thank you! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue16372] Initialization strange behavior

2012-10-31 Thread Mark Dickinson
Mark Dickinson added the comment: There's plenty of discussion of this feature of Python around the web, but this isn't the place to rehash it. :-) Google for "python mutable default argument". -- ___ Python tracker

[issue16372] Initialization strange behavior

2012-10-31 Thread Wojciech Danilo
Wojciech Danilo added the comment: Wow, I was using Python so long and I didn't know about it. Is there any paper discussing why this feature is better than storing "cache" as global variable / as class "private" parameter? -- ___ Python tracker

[issue16372] Initialization strange behavior

2012-10-31 Thread Mark Dickinson
Mark Dickinson added the comment: Actually, since you're using Python 3, I should have linked to the Python 3 documentation. Try this one: http://docs.python.org/3/faq/design.html#why-are-default-values-shared-between-objects -- ___ Python tracker

[issue16372] Initialization strange behavior

2012-10-31 Thread Mark Dickinson
Mark Dickinson added the comment: This is a feature, not a bug. :-) See http://docs.python.org/2/faq/design.html#why-are-default-values-shared-between-objects for more information. -- nosy: +mark.dickinson resolution: -> invalid status: open -> closed __

[issue16372] Initialization strange behavior

2012-10-31 Thread Wojciech Danilo
New submission from Wojciech Danilo: Hi! I'm using Python for several years and now I'm writing in Python 3 for the first time. I think I found a strange bug in it. Lets concider the code in the attachement. In the 33 line there is construction of new instance of class Result: print('!!!',Resul