Self Nanny

Michael Hudson mwh21 at cam.ac.uk
Mon Mar 6 16:02:20 EST 2000


Gaetan Corneau <corg at copernic.com> writes:

> OK, I didn't make myself clear :)
> 
> 1) *I* don't mind having to specify "self" in method definitions
> 
> 2) *I* don't mind having to write "self.Something"
> 
> 3) BUT I think that it would be *nice* not to have to specify "self" in
> method definitions, and it would certainly help A LOT of newbies
> 
> 4) if possible at all, not having to write "self.Something" would be cool,
> but not as important as #3
> 
> And don't tell me #3 can't (technically speaking) be done :)
> 
> If I'm mistaken, then OK, only C++ programmers forget to specify "self" as
> first parameter for a method, I won't insist, you know. If you really don't
> care about C++ programmers (but remember, there are quite a few), fine.
> 
> There could be other solutions even if you don't want to change things: why
> not emit a warning that you can turn off if you're an experienced Python
> programmer?
> 
> Is that clearer?  ;)

Oh, I see!  You want to elevate `self' to keyword status, so you'd
write:

class C:
    def __init__(a):
        self.a = a

? (I typed

    def __init__(self^H^H^H^Ha):

there :-)

An idea that's ten years too old, I suspect.  I don't know of any
archives that would stretch back far enough to cover the discussion of
this bit of Python "in the beginning", but it must have happened then
too.

still-no-chance-of-changing-ly y'rs
Michael

-- 
very few people approach me in real life and insist on proving they are
drooling idiots.                         -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list