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


Groups > comp.lang.python > #97095 > unrolled thread

Re: Modifying signature of ctor in class

Started by"Joseph L. Casale" <jcasale@activenetwerx.com>
First post2015-09-24 21:45 +0000
Last post2015-09-24 21:45 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Modifying signature of ctor in class "Joseph L. Casale" <jcasale@activenetwerx.com> - 2015-09-24 21:45 +0000

#97095 — Re: Modifying signature of ctor in class

From"Joseph L. Casale" <jcasale@activenetwerx.com>
Date2015-09-24 21:45 +0000
SubjectRe: Modifying signature of ctor in class
Message-ID<mailman.147.1443131216.28679.python-list@python.org>
> I don't think you can easily change the function's own definition,
> other than by using eval (or equivalent shenanigans, like crafting
> your own bytecode); but as of Python 3.something, the help() function
> looks for a __wrapped__ attribute and will take function args from
> that instead of the function itself. That way, when you use
> functools.wraps(), it copies in the docstring and stuff, and as far as
> help() is concerned, copies in the argument list too.
> 
> No idea whether you'll be able to do that too, but it's a fairly
> effective way to get around the problem if you can.

Hi Chris,
That is helpful. It still leaves me with generating a string function
and eval'ing or compiling it to swipe the sig. At the point I could
rebuild the entire function and simply apply it.

Where all but a valid sig helps is for introspection such as tab completing
with ipython or using an IDE etc.

Thanks everyone,
jlc

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web