AntiDecorator metaclass

Paul Morrow pm_mon at yahoo.com
Sat Aug 14 08:15:43 EDT 2004


Christophe Cavalaria wrote:

> Paul Morrow wrote:
> 
> 
>>One of the beautiful things about Python is its clear, minimal syntax.
>>So we must resist adding new syntax to the language, especially where
>>there is a reasonable alternative.
>>
>>I believe that Stefen Eischet's suggestion for automatically determining
>>a method's type (class/instance/static) from the name of its first
>>formal parameter is a reasonable alternative to any/all of the decorator
>>syntax proposals.
> 
> 
> Here is another one that forgot that decorators aren't limited to
> classmethod and staticmethod. Therefore, that proposal alone isn't an
> alternative to any other syntax.
> 
> If you want to say that decorators should be limited to classmethod and
> staticmethod, say it and give us a good reason, a very very good reason.

No I don't want to say that.  I want to say that decorators should keep 
their nose out of the classmethod/staticmethod business.  There's a 
perfectly good *no-extra-syntax-required* way to do that, thru the 
leveraging of conventions that most developers use already (give or take 
the spelling of the class parameter).  The code remains readable, 
intuitive, obvious, unintimidating.  And it makes the problem space that 
decorators address smaller (as it becomes everything you want decorators 
to do minus the classmethod/staticmethod stuff), which might give rise 
to a better, less objectionable solution.




More information about the Python-list mailing list