Setting Class Attributes

the.theorist the.theorist at gmail.com
Wed Oct 26 05:45:06 CEST 2005


So that it'll be easier to remember the next time I find myself in the
same situation on a different task, I'll extend the discussion
somewhat.

Coming from C, I had expected that I'd get a new empty dict every time
the __init__ function ran. Guido (or some other benevolent) had decided
to implement things a little bit differently in Python. I understand
that most everything is a pointer in Python. (which gives us cool stuff
like recursive data structures) So I was wondering, they could have
made the behavior C-like, but chose not to. The decision to bind
everything in the function to the same default args must be a
reflection of the Python Ideology. Philosophically, why was it done
this way, and how does it fit in with Python's design as a language.

(hopefully, reasons will help me remeber why things are the way they
are, so I don't forget in the future)
-----------------
I've only been using Python for a few weeks. (Chose it over Perl,
because Python syntax is cleaner). I really like Python (over C), as it
makes coding and debugging much faster and easier.




More information about the Python-list mailing list