[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: Two minor syntactic proposals
From: Roy Katz <katz () Glue ! umd ! edu>
Date: 2001-06-17 3:43:56
[Download RAW message or body]
Hello Gareth,
I am interested to know what you find inelegant about the existing
define-a-function-and-bind-it-to-a-class (d-b-c) idiom?
Look at it this way: The "in .. def" statement's only usable purpose is
to implement something which can already be done..
There was a similar proposal to add 'aliasing' to Python with a
"alias X: existingVar" statement, but Alex M. very nicely stated that a
simple '=' is elegant enough.
With regards to your latter proposal, again: having 'self' as the first
argument is *so* critical. Say class C has a method foo, and
an instance c. When one calls 'c.foo()', the interpreter calls
C.foo(c)'. That is why 'self' is the first argument to a method.
I suppose.. one could modify the interpreter to allow
statements like these:
class C:
def self.x(...): pass # method
def C.x(...): pass # static or class method
but then, 'self' was never a special keyword...
Roey
(note also that static methods can be implemented in modules instead of in
classes. I like this approach because I hate my CompSci instructors, who
like C++ and /insist/ on being able to define class methods
(imbecilic concept IMHO. print>>^H^H ). But that's just me.
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic