On Sep 12, 4:40 am, Bjoern Schliessmann <usenet-
[EMAIL PROTECTED]> wrote:
> Ivan Voras wrote:
> > What does "self" have to do with an object model? It's an
> > function/method argument that might as well be hidden in the
> > compiler without ever touching the role it has (if not, why?). I
> > agree that it's needless noise in a language.
>
> If this was needless, why do C++ and Java have the "this" pointer?
>
"this" in C++ and Java is not shown in the parameter list, which was
what he was
complaining about.  He wants

class MyClass:
        def SomeFunction(someParameter):
           self.someParameter = someParameter

not

class MyClass:
        def SomeFunction(self, someParameter):
           self.someParameter = someParameter


The confusing way about the current Python method when you first
encounter it is
 why is "self" being passed in when you write the function but not
when you call it. If the compiler is smart enough to know that

    a = MyClass()
    a.SomeFunction(12)

SomeFunction() has a "self" implicitly added to the parameter list, it
seems that it should be smart enough to know that a function defined
in a class has a "self" implicitly added to the parameter list.


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

Reply via email to