Re: [Openstack] Proposal to limit decorator usage

2012-01-17 Thread Sandy Walsh
Seems kind of arbitrary doesn't it?

Perhaps something about not using decorators with arguments instead? (since 
they're the biggest wart on the ass of Python)

-S


From: openstack-bounces+sandy.walsh=rackspace@lists.launchpad.net 
[openstack-bounces+sandy.walsh=rackspace@lists.launchpad.net] on behalf of 
Lorin Hochstein [lo...@nimbisservices.com]
Sent: Tuesday, January 17, 2012 12:09 PM
To: openstack@lists.launchpad.net
Subject: [Openstack] Proposal to limit decorator usage

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<https://www.nimbisservices.com/>





___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Proposal to limit decorator usage

2012-01-17 Thread Kevin L. Mitchell
On Tue, 2012-01-17 at 11:09 -0500, Lorin Hochstein wrote:

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

I'll point out that current discussion on that merge thread is favoring
a different idea altogether: restrict decorators to only those that "do
not mess with the conceptual interface of a function."  Mark provides
two examples of decorators which would not fit that restriction, and
Naveed objects to one of them because he feels that validation of input
arguments is a legitimate use of decorators.
-- 
Kevin L. Mitchell 


___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


[Openstack] Proposal to limit decorator usage

2012-01-17 Thread Lorin Hochstein
While going through merge proposal, I ran across this one from Mark 
Washenberger about limiting the number of decorators to 2 in nova code: 


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







smime.p7s
Description: S/MIME cryptographic signature
___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp