News for hackers. Stuff that matters.
Re:Anti-Patterns in Python Programming by hueving on Thursday July 10, 2014 @04:49AM (#8014237)
It's not broken when you understand that functions are objects and default parameters are just members of those objects. Each time the function is executed you get local vars that point to these object members. If one is a mutable type, any changes you make to it will then obviously persist.
Re:Anti-Patterns in Python Programming by ollysb on Thursday July 10, 2014 @10:29AM (#8015063)
It leaves me wondering, are the parameters also scoped to the class(seeing as they're declared at the same time)? Wouldn't this cause an issue with concurrent access to the function?
Re:Anti-Patterns in Python Programming by pas on Thursday July 10, 2014 @03:10PM (#8016553)
In Python there's no such thing, because GIL. Maybe in JPython.