[Python-Dev] func.update_meta (was: @deprecated)

Nick Coghlan ncoghlan at iinet.net.au
Mon Mar 14 14:33:35 CET 2005


Eric Nieuwland wrote:
> Neat! But please add something to the __doc__ so we can also see it was 
> changed. E.g.
>     self.__doc__ = other.__doc__ + os.linesep + "*** deprecated ***"

Decorators that alter the signature, or wish to change the docstring can make 
their modifications after copying from the original (or simply not copy from the 
original in the first place). E.g:

def deprecated(orig):
   def f(*args, **kwds):
     #Emit warning here
     return orig(*args, **kwds)
   f.update_meta(orig)
   f.__doc__ = "*** Deprecated *** " + f.__doc__
   return f

Any such changes are outside the purview of a metadata transfer method, though, 
since they're highly decorator dependent.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net


More information about the Python-Dev mailing list