[Openstack] Proposal to limit decorator usage

Lorin Hochstein lorin at nimbisservices.com
Tue Jan 17 16:09:30 UTC 2012


While going through merge proposal, I ran across this one from Mark Washenberger about limiting the number of decorators to 2 in nova code: <https://review.openstack.org/2966>

There's some good discussion on this in the proposal comments, but I thought it should hit the mailing list as well, in case folks wanted to weigh in but hadn't seen the proposal (I don't have a strong opinion pro or con here).

Here's the proposed addition for HACKING:

Decorators
----------
A function or method should not have more than two decorators applied to it
where it is defined.

Decorators are a powerful feature of Python that can eliminate some repetitive
code. However, decorator usage can be more difficult to debug or maintain than
alternative approaches to reduce repetition. These difficulties multiply when
decorators are stacked on top of each other. To ensure judicious use, we
therefore limit decorator depth to no more than two.



Take care,

Lorin
--
Lorin Hochstein
Lead Architect - Cloud Services
Nimbis Services, Inc.
www.nimbisservices.com





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120117/70860d35/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4897 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120117/70860d35/attachment.bin>


More information about the Openstack mailing list