Re: Decorators not worth the effort

Discussion in 'Python' started by Jean-Michel Pichavant, Sep 14, 2012.

  1. ----- 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
     
    Jean-Michel Pichavant, Sep 14, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jean-Michel Pichavant

    Re: Decorators not worth the effort

    Jean-Michel Pichavant, Sep 14, 2012, in forum: Python
    Replies:
    4
    Views:
    213
    Steve Howell
    Sep 15, 2012
  2. Jean-Michel Pichavant

    Re: Decorators not worth the effort

    Jean-Michel Pichavant, Sep 14, 2012, in forum: Python
    Replies:
    1
    Views:
    149
    Steven D'Aprano
    Sep 14, 2012
  3. andrea crotti

    Re: Decorators not worth the effort

    andrea crotti, Sep 14, 2012, in forum: Python
    Replies:
    0
    Views:
    148
    andrea crotti
    Sep 14, 2012
  4. Chris Angelico

    Re: Decorators not worth the effort

    Chris Angelico, Sep 14, 2012, in forum: Python
    Replies:
    2
    Views:
    173
    88888 Dihedral
    Sep 14, 2012
  5. andrea crotti

    Re: Decorators not worth the effort

    andrea crotti, Sep 14, 2012, in forum: Python
    Replies:
    0
    Views:
    157
    andrea crotti
    Sep 14, 2012
Loading...

Share This Page