[Python-Dev] the explicit self

Cesare Di Mauro cesare.dimauro at a-tono.com
Wed Aug 27 09:14:05 CEST 2008


On 27 agu 2008 at 08:46:15, Kilian Klimek <kilian.klimek at googlemail.com> wrote:

> Hello,
>
> i know this has been discusses very much, i'm sorry,
> but i can't help it. In a nutshell, the proposal is as
> follows:
>
> 1. Self remains explicit (like it is now).
> 2. if a class is a subclass of a special class, e.g.
>    named 'selfless', the self parameter is not required
>    and a special variable, named 'this' is provided.
>
>
> For example:
>
> class Foo (selfless):
>     def __init__ (x, y):
>         this.x = x
>         ...
>
> A patch for 3.0b3 implementing this can be found at
> http://www-lehre.inf.uos.de/~kklimek/misc/python_slp_8.diff
>
> regards,
> Kilian Klimek
> 

I disagree. From "The Zen of Python":

Explicit is better than implicit.
Readability counts.
Special cases aren't special enough to break the rules.
There should be one-- and preferably only one --obvious way to do it.

Cheers,
Cesare


More information about the Python-Dev mailing list