Mutable class instance variables in Python act like they're static

Editor Rating

posted on jan 13 by djangolinks

mutable objects python static

  • ID: 323
  • Title:

    Mutable class instance variables in Python act like they're static

  • Url: http://rustyrazorblade.com/2008/05/class-instance-variables-in-python-act-like-theyre-static/
  • Description: There's a weird behavior in Python when dealing with Mutable types such as dictionaries, that when you modify a variable defined as a class attribute, you're actually modifying a shared dictionary amongst all the classes.
  • Total Votes: 1

Latest Premium Django Jobs from Djangojobs.Net

Django Developer
Python Software Engineer (Relocation)
Senior Software Engineer (Python)
Software Engineer Python
Web Applications Developer (Remote in USA)