[Python-Dev] Decorator keyword possibility?
Nick Coghlan
ncoghlan at iinet.net.au
Thu Aug 12 01:26:38 CEST 2004
Someone recently suggested 'remake' as a possible replacement for '@'
I don't like that name because Python doesn't use the word 'make' for
anything. However, it immediately prompted the thought of 'redef'
After all, decorator's effectively 'redefine' the original 'define'
block, to mean something else.
And the old decorator syntax is *definitely* a 'redefinition' syntax.
However, the problem with that word is that you would expect it to come
_after_ the definition (like the old syntax does). Which leads to the
actual suggestion of a 'predefinition'.
That is, we're going to tell you about the definition before we actually
get to it.
And so, on with the examples:
class demo(object):
predef classmethod
def foo(cls): pass
predef staticmethod
def bar(): pass
predef accepts(int, int)
predef returns(bool)
predef someOtherDecorator(anarg, anotherarg, yetanotherarg)
def foobar(self, apples, oranges):
"""Compares apples and oranges"""
return apples < oranges
Regards,
Nick.
--
Nick Coghlan | Eugene, Oregon
Email: ncoghlan at email.com | USA
More information about the Python-Dev
mailing list