What's better about Ruby than Python?
mertz at gnosis.cx
Wed Aug 20 03:41:51 CEST 2003
Alexander Schmolck <a.schmolck at gmx.net> wrote previously:
|Anyway, I still don't see a compelling reason why class statements
|couldn't/shouldn't be mutating, rather than rebinding. Is there one?
I don't think there is any reason why the statement 'class' COULD NOT do
what you describe. But doing so seems much less Pythonic to me.
In Python, there are a bunch of statements or patterns that ALWAYS and
ONLY binds names. Having something that sometimes binds names, and
other times mutates objects... and you cannot tell the difference
without finding something that may be far away in the code.... well,
that's not how Pythonistas like to think about code.
In the first appendix to my book (<http://gnosis.cx/TPiP> for the free
version) I make quite a point of explaining what Python does without the
sort of "convenient fiction" that most intros/summaries use. That is,
usually the difference between binding a name and assigning a value is
sort of brushed over, I guess so previous C, Pascal, Perl, Basic, etc.
programmers won't get freaked out. I know Alexander already knows
this... but heck, why miss some self-aggrandizement?
X-Shameless-Plug: Buy Text Processing in Python: http://tinyurl.com/jskh
mertz@ _/_/_/_/_/_/_/ THIS MESSAGE WAS BROUGHT TO YOU BY:_/_/_/_/ v i
gnosis _/_/ Postmodern Enterprises _/_/ s r
.cx _/_/ MAKERS OF CHAOS.... _/_/ i u
_/_/_/_/_/ LOOK FOR IT IN A NEIGHBORHOOD NEAR YOU_/_/_/_/_/ g s
More information about the Python-list