[Python-Dev] PEP 318 needs a rewrite
Greg Ewing
greg at cosc.canterbury.ac.nz
Mon Mar 8 18:19:26 EST 2004
Guido:
> As a human reader, I like seeing the attributes before the arguments
> because some attributes (like classmethod and staticmethod) affect the
> interpretation of the argument list.
On the other hand, this weakens the syntactic parallels between
function definitions and function calls. Somehow, a def which doesn't
have an open paren immediately after the function name doesn't look
function-definition-ish to me.
With suitable argument naming conventions, the argument list itself
usually gives enough cues to make it clear if it's a classmethod or
staticmethod:
def foo(self, x, y, z):
# self => it's a normal method
def bar(cls, x, y, z) [classmethod]:
# cls => it's a class method
def baz(x, y, z) [staticmethod]:
# neither self nor cls => it's a static method
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg at cosc.canterbury.ac.nz +--------------------------------------+
More information about the Python-Dev
mailing list