[Python-Dev] Re: Re: Call for defense of @decorators
walter at livinglogic.de
Tue Aug 10 15:28:23 CEST 2004
Skip Montanaro wrote:
> Walter> So how about:
> Walter> make classmethod
> Walter> def foo(cls, bar):
> Walter> ...
> I don't think anybody's come up with a candidate keyword that reads well in
> most/all situations. Consider:
> make accepts(int, (int, float))
> make returns(int)
> def foo(arg1, arg2):
> return arg1 * arg2
> While you can contort "make" to mean what you want in this case it's clearly
> a much different meaning ("ensure that (or force) this function to accept
> and return these types) than "make classmethod" ("turn this function into a
> class method"). Other potential keywords have similar problems.
If you know what the keyword is, you can rename the decorator
make argcheck(int, (int, float))
But we could choose a keyword that doesn't mean anything, e.g.
'dec' or 'decorate'.
More information about the Python-Dev