[Python-Dev] method decorators (PEP 318)

Paul Prescod paul at prescod.net
Sat Mar 27 18:15:00 EST 2004


Barry Warsaw wrote:

>...
> I know all the practical problems with this suggestion, but to me,
> that's the most natural spelling.  I suppose something like this might
> also not be horrible:
> 
> def foobar [
>     .author = 'Guido van Rossum'
>     .deprecated = True
>     classmethod
>     ] (self, arg)
> 
> Naw, these probably don't mix well.  Hmm,
> 
> def foobar {
>     author = 'Guido van Rossum'
>     deprecated = True
>     } [classmethod, spoogemethod, insanity
>     ] (self, arg):
>     # Now what the heck does this thing do?

I think that Guido's point is that some things belong before the def 
because they really change the behaviour of the function and others 
belong after because they are "just" annotations:

def foobar [classmethod, spoogemethod] (self, arg) {
		author = "Guido van Rossum"
		zope_public = "True"
	}:
	pass

  Paul Prescod





More information about the Python-Dev mailing list