Fuzzyman wrote:
On Jul 24, 6:41 am, Jordan <[EMAIL PROTECTED]> wrote:
Hi everyone,
I'm a big Python fan who used to be involved semi regularly in
comp.lang.python (lots of lurking, occasional posting) but kind of
trailed off a bit. I just wrote a frustration inspired rant on my
blog, and I thought it was relevant enough as a wider issue to the
Python community to post here for your discussion and consideration.
This is not flamebait. I love Python, and I'm not out to antagonise
the community. I also realise that one of the issues I raise is way
too ingrained to be changed now. I'd just like to share my thinking on
a misstep in Python's guiding principles that has done more harm than
good IMO. So anyway, here's the post.
I've become utterly convinced that at least one criticism leveled at
my favourite overall programming language, Python, is utterly true and
fair. After quite a while away from writing Python code, I started
last night on a whim to knock up some code for a prototype of an idea
I once had. It's going swimmingly; the Python Image Library, which I'd
never used before, seems quick, intuitive, and with the all the
features I need for this project. As for Python itself, well, my heart
still belongs to whitespace delimitation. All the basics of Python
coding are there in my mind like I never stopped using them, or like
I've been programming in this language for 10 years.
Except when it comes to Classes. I added some classes to code that had
previously just been functions, and you know what I did - or rather,
forgot to do? Put in the 'self'. In front of some of the variable
accesses, but more noticably, at the start of *every single method
argument list.* This cannot be any longer blamed as a hangover from
Java - I've written a ton more code, more recently in Python than in
Java or any other OO language. What's more, every time I go back to
Python after a break of more than about a week or so, I start making
this 'mistake' again. The perennial justification for this 'feature'
of the language? That old Python favourite, "Explicit is better than
implicit."
It's damn useful for scoping. You can look in the body of your method
and tell whether you are accessing local variables or instance
variables.
I'm a great fan of self and I'm afraid you're flogging a dead horse on
that one.
Your point about rich comparison (at least the == != problem) is fair..
This one is fixed in Python 3 though I believe.
Michael Foord
--
http://www.ironpythoninaction.com/
I hope that the OP will develop some
specific proposal, narrowly focused on
the "self" issue.
It has always seemed redundant on the
argument line of a definition. It does
permit one to use some other word but is
that of any real value.
One can still use self.a= 'z' or perhaps
.a= 'z'.
Colin W.
--
http://mail.python.org/mailman/listinfo/python-list