Deprecate self

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Apr 18 13:53:56 EDT 2001


Wed, 18 Apr 2001 14:40:41 GMT, Rainer Deyke <root at rainerdeyke.com> pisze:

> The thing that bothers me about using 'self' is that it is inconsistent.

So let's allow
    def self.method(arg1, arg2):
to have the definition syntax consistent with a call.

> The relationship of a method to the object on which it is called
> is analogous to the relationship between a free function and its
> module, yet only the former supports the 'self.x' convention.

Indeed there is a correspondence.

The difference is that the function will get an object as an additional
argument if it's obtained from a class, but it won't get anything if
it's obtained from a module (the "anything" would have to be related
to the module as instance is related to its class, and there is even
no such thing).

The syntactic difference is a result of a semantic difference.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list