This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jafo
Recipients jafo
Date 2013-03-18.19:28:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1363634908.24.0.328238264763.issue17424@psf.upfronthosting.co.za>
In-reply-to
Content
This might be a duplicate of issue17053, but the patch provided there doesn't resolve the issue, at least as far as I know it.  Here is an example, from David Beazley's talk at PyCon 2013:

from inspect import Parameter, Signature

def make_signature(names):
   return Signature(
         Parameter(name, Parameter.POSITIONAL_OR_KEYWORD) for name in names)

class Structure:
   __signature__ = make_signature([])
   def __init__(self, *args, **kwargs):
      bound = self.__signature__.bind(*args, **kwargs)
      for name, val in bound.arguments.items():
         setattr(self, name, val)

class Stock(Structure):
   __signature__ = make_signature(['name', 'shares', 'price'])

pyth = Stock('PYTH', 100, 50)
help(pyth.__init__)

Which produces:

__init__(self, *args, **kwargs) method of __main__.Stock instance

Instead of:

__init__(self, name, shares, price) method of __main__.Stock instance
History
Date User Action Args
2013-03-18 19:28:28jafosetrecipients: + jafo
2013-03-18 19:28:28jafosetmessageid: <1363634908.24.0.328238264763.issue17424@psf.upfronthosting.co.za>
2013-03-18 19:28:28jafolinkissue17424 messages
2013-03-18 19:28:27jafocreate