[patch] deprecation warnings branch

John Arbash Meinel john at arbash-meinel.com
Mon Jan 16 01:52:45 GMT 2006


Robert Collins wrote:
> On Wed, 2006-01-11 at 07:04 -0600, John Arbash Meinel wrote:
> 
> 
>>If you look at Andrew Bennet's post, they have some code for dynamically
>>generating the wrapped function, which can help.
>>
>>But it might be easiest to do
>>
>>wrap_func.__doc__ = signature + orig_func.__doc__
>>
>>Would that be sufficient? If you saw
>>
>>my_function = wrap(self, *args, **kwargs):
>>  my_function(self, foo, baz=None)
>>  stuff about my_function
> 
> 
> 
> Hmm, the first line is special though. I'd rather do:
> new_doc = orig_func.__doc__ + signature 
> (appropriately adjusted for indenting of course).
> 
> Rob
> 

Well, if you look at the builtin functions (C functions frequently don't
have args), they almost always put the correct signature right after the
bad signature.


>>> help(''.encode)
encode(...)
    S.encode([encoding[,errors]]) -> object

    Encodes S using the codec registered for encoding. encoding defaults
    to the default encoding. errors may be given to set a different error
    handling scheme. Default is 'strict' meaning that encoding errors raise
    a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
    'xmlcharrefreplace' as well as any other name registered with
    codecs.register_error that is able to handle UnicodeEncodeErrors.

I find that the most useful, since that means the signature of the
function is right next to where the signature should be.

I do understand how this might mess up some documentation stuff that
expects to read just the first line. But I also find it more important
to see the method signature than a 1 line summary with no arguments.

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060115/60ffd73d/attachment.pgp 


More information about the bazaar mailing list