Attack a sacred Python Cow
Paul Boddie
paul at boddie.org.uk
Sat Jul 26 14:22:59 EDT 2008
On 26 Jul, 06:06, Terry Reedy <tjre... at udel.edu> wrote:
> Paul Boddie wrote:
> > "The problem is that the explicit requirement to have self at the
> > start of every method is something that should be shipped off to the
> > implicit category."
Here, I presume that the author meant "at the start of every method
signature".
> There is no requirement to have 'self' in the parameter list. It can be
> 's', 'this', 'me', 'yo'(Spanish for I), or 'cls' (for class methods), or
> any other identifier in whatever language.
But Jordan apparently wanted to omit that parameter. The omission of
all mentions of "self" could be regarded as a bonus, but it's a non-
trivial goal.
> In 3.0, identifiers are not restricted to ascii but can be any unicode
> 'word' as defined in the manual.
>
> So the proposal would have to be that the compiler scan the function
> body and decide which dotted name prefix is the one to be implicitly
> added. Have fun writing the discovery algorithm. However, I think this
> is pretty silly. Just write the name you want.
If, as I wrote, you permit the omission of "self" in method signatures
defined within class definitions, then you could still insist on
instance attribute qualification using "self" - exactly as one would
when writing Java according to certain style guidelines.
Paul
More information about the Python-list
mailing list