Guido's new method definition idea

ptn tn.pablo at gmail.com
Tue Dec 9 09:45:06 EST 2008


On Dec 6, 10:15 am, "Russ P." <Russ.Paie... at gmail.com> wrote:
> On Dec 6, 4:32 am, Andreas Waldenburger <geekm... at usenot.de> wrote:
>
>
>
> > On Sat, 6 Dec 2008 04:02:54 -0800 (PST) bearophileH... at lycos.com wrote:
>
> > > class C:
> > >     def $method(arg):
> > >         $value = arg
>
> > > (Note there's no point after $, it's not currently possible).
> > > Ruby uses @ and @@ for similar purposes.
> > > I agree that the code looks worse, but also shorter to read and write,
> > > so in lines of code that use many instance attributes, that short $
> > > syntax helps keep the line shorter. So I may grow to accept this
> > > sugar...
>
> > But that is not the way Python is meant to work. There are several
> > tennets in the Zen of Python that don't chime well with this approach.
> > "self" is a speaking identifier, "$" isn't.
>
> Is "@" a "speaking identifier? How about "#" and "!="? Last I heard,
> they were all part of Python.

Those are operators and the comment starter, not identifiers.

I think that the more used an operator/variable is, the least mnemonic
it' name has to be.  Given that you'll be useing it all the time, you
don't need it's name reminding you what it's supposed to be used for.
So the "it's not a speaking-identifier" argument is not a good one, in
my opinion.

However, $ being ugly is a very strong argument.  Python is supposed
to be beautiful.  And sure you can get used to it, just as you can get
used to Pearl, assembly language or Brainfuck.  By beautiful we mean
beautiful at first sight.



More information about the Python-list mailing list