Roundup Robot added the comment:
New changeset 8a4e44473fdd by Yury Selivanov in branch 'default':
inspect.Signature: Add 'Signature.from_callable' classmethod. Closes #17373
http://hg.python.org/cpython/rev/8a4e44473fdd
--
nosy: +python-dev
resolution: - fixed
stage: patch review -
Eric Snow added the comment:
Thanks, Yury!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17373
___
___
Python-bugs-list mailing list
Changes by Yury Selivanov yselivanov...@gmail.com:
--
assignee: - yselivanov
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17373
___
___
Changes by Yury Selivanov yselivanov...@gmail.com:
--
versions: +Python 3.5 -Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17373
___
Eric Snow added the comment:
The difference is that inspect.signature is not friendly to Signature
subclasses. Without from_callable you can't customize the behavior in
inspect.signature easily.
--
___
Python tracker rep...@bugs.python.org
Yury Selivanov added the comment:
The difference is that inspect.signature is not friendly to Signature
subclasses. Without from_callable you can't customize the behavior in
inspect.signature easily.
OK, suppose you have Signature.from_callable. You then create a subclass
MySignature, and
Yury Selivanov added the comment:
Eric,
Moreover, 'Signature.from_function' and newly added 'Signature.from_builtin'
are private API, or implementation detail (they are not part of PEP, not
mentioned in the docs). If at some point it is needed to rewrite Signature
in C, probably those two
Eric Snow added the comment:
It's not about customizing inspect.signature. It's about customizing the
nice behavior of that function, including what type it returns.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17373
Yury Selivanov added the comment:
OK, got it now.
Green light from me. Looking through the code, I saw that 'from_builtin'
doesn't use the 'Signature._parameter_cls' (as in from_function). That's
probably needs to be fixed as well, maybe in a separate issue.
--
Yury Selivanov added the comment:
Hi Eric,
I'm not sure why do you want this. Having Signature.from_callable does not
allow you to change behaviour of 'inspect.signature' function. More over, it
creates a confusion about what API should be used - 'inspect.signature' or
Andrew Svetlov added the comment:
Agree in general, but you need to update the docs also.
--
nosy: +asvetlov
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17373
___
New submission from Eric Snow:
While working on a subclass of inspect.Signature, I realized that
inspect.signature is treated as the constructor. So subclassing isn't so
simple. At first I considered adding an extra parameter to inspect.signature
allowing different Signature classes. Not
12 matches
Mail list logo