On Tuesday, May 26, 2015 at 11:57:44 AM UTC-5, Laura Creighton wrote:
> In a message of Tue, 26 May 2015 09:37:29 -0700, zipher writes:
> >Would it be prudent to rid the long-standing "argument" (pun unintended) 
> >about self and the ulterior spellings of it, by changing it into a symbol 
> >rather than a name?  

> >class MyClass(object):
> >
> >    def __init__(@):
> >        @.dummy = None
> >
> >OR, even better, getting *rid of it* in the parameter list, so it stops 
> >confusing people about how many parameters a method needs, and transform it 
> >into a true *operator*.
> >
> >class MyClass(object):
> >
> >    def __init__(): #takes no arguments!
> >        @.dummy = None  #the @ invokes the class object's dictionary
> >
> >That would seem to be a nice solution to the problem, really.  It doesn't 
> >become PERLish because you've made it into a genuine operator -- "self" was 
> >always a non-variable that looked like a variable and hence created an itch 
> >that couldn't be scratched.
>
> Guido did.  :)
> http://neopythonic.blogspot.se/2008/10/why-explicit-self-has-to-stay.html

Sweet link.  I see now that my confusion surrounds the mistaken notion that 
Python is lexing python source into *abstract syntax trees* (wikipedia 
describes nicely), so that code inside a method knows what class it's in.

But GvR hasn't defined his language to the extent where the notion of "object" 
even exists.  He's only set aside a keyword called "class".  So of course he 
has to treat the method code, practically, like a [C] function.  But that 
limits the language, not to define what an object is inside the lexical 
structure:

object ::= "class" identifier "(" inheritence_list ")" ":"
inheritence_list ::= [[et cetera]]

If he did this, then code inside the class could already know what class 
they're in and all the objections in Laura's link would be moot.

Mark J

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to