Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29175

Re: Decorators not worth the effort

Date 2012-09-14 17:35 +0200
From Jean-Michel Pichavant <jeanmichel@sequans.com>
Subject Re: Decorators not worth the effort
Newsgroups comp.lang.python
Message-ID <mailman.710.1347636980.27098.python-list@python.org> (permalink)

Show all headers | View raw


----- Original Message -----
> On Fri, 14 Sep 2012 15:22:26 +0200, Jean-Michel Pichavant wrote:
> 
> > Here's Steven example:
> > 
> > # Untested!
> > def timeout(t=15):
> >     # Decorator factory. Return a decorator to actually do the
> >     work. if
> >     FPGA:
> >         t *= 3
> >     def decorator(func):
> >         @functools.wraps(func)
> >         def inner(self, timeout):
> >             self.sendCmd("bootMe", timeout=t)
> >         return inner
> >     return decorator
> > 
> > I can assure you, that for some python users, it's is not easy to
> > understand what it does, this function returning a function which
> > returns another (wrapped) function. It requires some effort.
> 
> Oh I agree. So does learning to tie your shoe-laces, learning to
> cook,
> and learning to drive.
> 
> Learning to be a world-class chess master takes a lot of effort.
> Learning
> about decorators does not.
> 
> 
> --
> Steven

I said some effort, not a lot of effort. Something else that requires some effort it to make experts realize that some things they consider trivial and easy, aren't actually for a lot of people. 
Returning to my cave.

JM


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Decorators not worth the effort Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-09-14 17:35 +0200

csiph-web