[Python-Dev] method decorators (PEP 318) (original) (raw)
Delaney, Timothy C (Timothy) tdelaney at avaya.com
Sun Mar 28 22:33:53 EST 2004
- Previous message: [Python-Dev] PEP 318 - posting draft
- Next message: [Python-Dev] PEP 318 and syntax coloring
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: Greg Ewing
Particularly considering the latter restriction, I'm wondering whether these should be treated differently in the syntax. Maybe something like def [type2trans] foo(args) [type1trans, type1trans...]: ... or def foo [type2trans] (args) [type1trans, type1trans...]: ... This might also help satisfy Guido's concerns about the positioning of 'classmethod' and 'staticmethod', since, being type 2 transformers, they would go up front.
Hmm - this seems like it has possibilities. Since we could only have one decorator that returned a descriptor, we could dispense with the [] on those, leading to:
def descriptor_trans func_name (func_args) [callable_trans, callable_trans, ...]:
...
e.g.
def classmethod foo (cls, arg1, arg2) [synchronized(lock)]:
pass
which I think satisfies most the (IMO) most important requirements that various people have put forwards, namely:
classmethod
andstaticmethod
are very important and should be very obvious (Guido seems absolutely adamant on this);The name of the method should be near
def
;There should be nothing between the name of the function and the arguments.
Tim Delaney
- Previous message: [Python-Dev] PEP 318 - posting draft
- Next message: [Python-Dev] PEP 318 and syntax coloring
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]