[Python-Dev] PEP 318: Let's not give in to FUD

Jack Diederich jack at performancedrivers.com
Thu Apr 1 20:38:36 EST 2004


On Fri, Apr 02, 2004 at 12:05:39PM +1200, Greg Ewing wrote:
> I think most of the worry about long, complicated
> decorator lists with baroque parameters is FUD.
> What are the realistic use cases for such things?
> I don't remember seeing any proposed.
> 
> The ones I have seen proposed (e.g. PyObjC) use
> only one or two decorators at a time, and if there
> are any parameters, they're not lengthly.
> 
> Furthermore, if in some circumstance someone finds
> themselves writing decorator lists so long that they
> become unreadable, well, there are ways of dealing
> with that. For example,
> 
> foo_decorators = decorator_list(
>   # Big long-winded
>   # list of
>   # decorators
> )
> 
> def foo(args) [foo_decorators]:
>   ...
> 
I was actually about post the same in the bake-off thread,
but with the super-obvious

see_above = decorator_list(
   decorator1,
   ..
   decoratorN,
)
def foo(args) [see_above]:
  ...

You can't beat that for obviousness, even newbies know _something_
is going on and it happens just above.

no_joy = decorator_list(
  decorator1,
  ..
  decoratorN,
)
[no_joy]
def foo(args): # modified by no_joy

So the best case is a comment that will vary by style.
Do newbies read comments? dunno.

-jackdied



More information about the Python-Dev mailing list