- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
➜
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 | larry |
|---|---|
| Recipients | Claudiu.Popa, Yury.Selivanov, larry, michael.foord, ncoghlan, terry.reedy, yselivanov |
| Date | 2014-01-25.03:56:05 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1390622166.01.0.183307451664.issue17481@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
|---|
There's a major difference between getfullargspec/getargspec and inspect.signature: getfullargspec shows you the "self" parameter for bound methods, and inspect.signature does not.
>>> class C:
... def foo(self, a): pass
...
>>> c = C()
>>>
>>> import inspect
>>> str(inspect.signature(c.foo))
'(a)'
>>> inspect.getfullargspec(c.foo)
FullArgSpec(args=['self', 'a'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
>>> inspect.getargspec(c.foo)
ArgSpec(args=['self', 'a'], varargs=None, keywords=None, defaults=None)
This is why help() (currently) shows bound parameters for methods implemented in Python, but doesn't show them for methods implemented in C. pydoc uses inspect.getfullargspec for pure Python functions and inspect.signature for builtins. |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2014-01-25 03:56:06 | larry | set | recipients: + larry, terry.reedy, ncoghlan, michael.foord, Claudiu.Popa, Yury.Selivanov, yselivanov |
| 2014-01-25 03:56:06 | larry | set | messageid: <1390622166.01.0.183307451664.issue17481@psf.upfronthosting.co.za> |
| 2014-01-25 03:56:05 | larry | link | issue17481 messages |
| 2014-01-25 03:56:05 | larry | create |
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements
