Guido's new method definition idea

Russ P. Russ.Paielli at gmail.com
Sat Dec 6 10:21:40 EST 2008


On Dec 6, 4:37 am, Andreas Waldenburger <geekm... at usenot.de> wrote:
> On Sat, 6 Dec 2008 13:32:58 +0100 Andreas Waldenburger
>
> <geekm... at usenot.de> wrote:
> > On Sat, 6 Dec 2008 04:02:54 -0800 (PST) bearophileH... at lycos.com
> > suggested:
>
> > > class C:
> > >     def $method(arg):
> > >         $value = arg
>
> > > [snip]
>
> > [snip]
> > "self" is a speaking identifier, "$" isn't.
>
> Also, nothing prevents you from replacing "self" with "s" if you really
> want it short. Same effect as your "s" suggestion (OK, plus one ".").

Yes, you can always use "s". But single-letter identifiers are not
usually a good idea, because they are hard to search on. A slightly
better option is "S", which is a little better for searching but not
as good as "$". I have considered using "S" extensively in my code,
but I hesitate because it is not recognized in official Python coding
standards.



More information about the Python-list mailing list