Explicit Frustration of the Self
Cliff Wells
LogiplexSoftware at earthlink.net
Tue Dec 31 16:37:23 EST 2002
On Tue, 2002-12-31 at 12:47, Bengt Richter wrote:
> On Tue, 31 Dec 2002 16:19:32 GMT, Andrew Koenig <ark at research.att.com> wrote:
>
> >> What of elegance?
> >
> >> class Life:
> >> property = "value"
> >> def Meaning(self, argument):
> >> return self.property
> >
> >> This whole business with the self; it is not elegant. And, it is of
> >> my opinion that it is, therefore, not good programming. So I'm
> >> angry, because most of Python is so easy, so elegant, and this
> >> ain't.
> >
> >How would you like to be able to write it instead? Show us some
> >examples. Whatever you come up with, I'll bet it will be possible
> >to find even greater problems.
> >
> Someone proposed just a bare leading dot or invisible self name.
>
> class Foo:
> bar = 123
> def baz(,arg):
> .arg = arg
> return .bar+arg
>
> It's less typing anyway. That's a plus for me.
I (sheepishly) admit that I'm kind of fond of the "with" statement some
languages have:
somelongname.x = 1
with somelongname:
.x += 1
print .x
It's a bit more explicit and more versatile as well (can be used for
more than just self). I'm certain a PEP has been written and rejected
on this (or maybe enough arguing was done on c.l.py that a PEP was never
bothered with), so I'll just be jealous of VB programmers for this one
little thing.
--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308
More information about the Python-list
mailing list