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


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

Re: Modifying signature of ctor in class

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2015-09-24 16:10 -0600
Last post2015-09-24 16:10 -0600
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 Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-24 16:10 -0600

#97098 — Re: Modifying signature of ctor in class

FromIan Kelly <ian.g.kelly@gmail.com>
Date2015-09-24 16:10 -0600
SubjectRe: Modifying signature of ctor in class
Message-ID<mailman.150.1443132660.28679.python-list@python.org>
On Thu, Sep 24, 2015 at 2:28 PM, Joseph L. Casale
<jcasale@activenetwerx.com> wrote:
> I have a class factory where I dynamically add a constructor to the class output.
> The method is a closure and works just fine, however to accommodate the varied
> input its signature is (*args, **kwargs).
>
> While I modify the doc strings, the ctor sig is not optimal. Without building
> this a string and using eval, is there anything that can be done about this?

In Python 3.3+ you can attach a Signature object to a function by
setting the function's __signature__ attribute. In Python 3.4+ the
__signature__ is used in generating the signature for PyDoc and
help().

[toc] | [standalone]


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


csiph-web