I love the decorator in Python!!!

88888 Dihedral dihedral88888 at googlemail.com
Sun Dec 11 23:51:58 EST 2011


On Monday, December 12, 2011 11:36:07 AM UTC+8, alex23 wrote:
> On Dec 9, 8:08 pm, Robert Kern <rober... at gmail.com> wrote:
> > On 12/9/11 5:02 AM, alex23 wrote:
> > > The 3rd party 'decorator' module takes care of issues like docstrings
> > > &  function signatures. I'd really like to see some of that
> > > functionality in the stdlib though.
> >
> > Much of it is:
> >
> >    http://docs.python.org/library/functools#functools.update_wrapper
> 
> Ah, cheers :) Is that a recent addition? The lack of note makes it
> seem like it was there from the beginning?

To wrap a function properly is different from the 1-line lampda. 

This is really functional programming.

Every function can be decorated to change into a different one easily. 

There is  a method to replace every return action  of a python function 
into an  yield action without the source code.


 

 




More information about the Python-list mailing list