Re: [Python-Dev] [Python-checkins] peps: Add PEP 422: Dynamic Class Decorators

2012年6月05日 14:33:03 -0700

Terry Reedy dixit (2012年06月05日, 12:42):
> On 6/5/2012 8:09 AM, nick.coghlan wrote:
> 
> > Add PEP 422: Dynamic Class Decorators
[snip]
> >+So too will the following be roughly equivalent (aside from inheritance)::
> >+
> >+ class C:
> >+ __decorators__ = [deco2, deco1]
> 
> I think you should just store the decorators in the correct order of use
> + __decorators__ = [deco1, deco2]
> and avoid the nonsense (time-waste) of making an indirect copy via
> list_iterator and reversing it each time the attribute is used.
+1. For @-syntax the inverted order seems to be somehow natural. But I
feel the list order should not mimic that...
***
Another idea: what about...
 @@dynamic_deco2
 @@dynamic_deco1
 class C:
 pass
...being an equivalent of:
 class C:
 __decorators__ = [dynamic_deco1, dynamic_deco2]
...as well as of:
 @@dynamic_deco2
 class C:
 __decorators__ = [dynamic_deco1]
?
Cheers.
*j
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to