RE: [Python-Dev] Re: PEP 318: Decorators last before colon

python-dev-bounces+tdelaney=avaya.com@python.org wrote:
If you spell decorators this way:
[decorator] def func(): pass
then what will happen when you type [decorator] at an interactive interpreter prompt?
[decorator]
I've been waiting and reading all the threads before chiming in ... At first the [decorator] def func(): pass had some appeal, although I definitely didn't like it as much as: def func() [decorator]: pass because it split the function definition up into two bits - I lose the association with the def. However, as these threads have progressed, it's become obvious to me that there are too many ways in which this is a special case for me to be happy with it. I've seen lots of objections brought up based on existing behaviours with the construct, and each time it's been waved away as not being common enough to worry about. These are often actual use cases that experienced developers have - documentation tools, editor configuration, etc. Well, it is worrying me. Each special case is one more thing that adds a burden to using Python. The fact that whitespace and comments are allowed between the decorator and function definition is particularly worrying to me - it can quite easily mask errors in code - particularly newbie errors: [a] # oops - I copied this from an interactive session and forgot to modify it. # This is a simple function def func (args): pass Tim Delaney

On the advisability of [decorator] def func(): pass vs. def func() [decorator]: pass I'm beginning to think Guido has staged an elaborate April Fool's joke. <hopeful wink> Skip

On the advisability of
[decorator] def func(): pass
vs.
def func() [decorator]: pass
I'm beginning to think Guido has staged an elaborate April Fool's joke.
<hopeful wink>
+1 -- Christian Tanzer http://www.c-tanzer.at/
participants (3)
-
Delaney, Timothy C (Timothy)
-
Skip Montanaro
-
tanzer@swing.co.at