globalrev <[EMAIL PROTECTED]> wrote:
> class Foo(object):
>        def Hello(self):
>                print "hi"
> 
> object is purple, ie some sort of reserved word.
> 
> why is self in black(ie a normal word) when it has special powers.

Because `self` is just a name. Using `self` is a convention, but one can
use any name which is not reserved.

> replacing it with sel for example will cause an error when calling
> Hello.

Which error? I don't get one.

0:tolot:/tmp> python f.py
hi
0:tolot:/tmp> cat f.py
class Foo(object):
        def Hello(sel):
                print "hi"

Foo().Hello()
0:tolot:/tmp> 

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

Reply via email to