Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
224c9c1f
Commit
224c9c1f
authored
Jan 30, 2014
by
Yury Selivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inspect.docs: Document constructors for Signature & Parameter #20442
parent
bb08b365
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
Doc/library/inspect.rst
Doc/library/inspect.rst
+11
-2
No files found.
Doc/library/inspect.rst
View file @
224c9c1f
...
@@ -435,12 +435,21 @@ function.
...
@@ -435,12 +435,21 @@ function.
no metadata about their arguments.
no metadata about their arguments.
.. class:: Signature
.. class:: Signature
(parameters=None, \*, return_annotation=Signature.empty)
A Signature object represents the call signature of a function and its return
A Signature object represents the call signature of a function and its return
annotation. For each parameter accepted by the function it stores a
annotation. For each parameter accepted by the function it stores a
:class:`Parameter` object in its :attr:`parameters` collection.
:class:`Parameter` object in its :attr:`parameters` collection.
The optional *parameters* argument is a sequence of :class:`Parameter`
objects, which is validated to check that there are no parameters with
duplicate names, and that the parameters are in the right order, i.e.
positional-only first, then positional-or-keyword, and that parameters with
defaults follow parameters without defaults.
The optional *return_annotation* argument, can be an arbitrary Python object,
is the "return" annotation of the callable.
Signature objects are *immutable*. Use :meth:`Signature.replace` to make a
Signature objects are *immutable*. Use :meth:`Signature.replace` to make a
modified copy.
modified copy.
...
@@ -489,7 +498,7 @@ function.
...
@@ -489,7 +498,7 @@ function.
"(a, b) -> 'new return anno'"
"(a, b) -> 'new return anno'"
.. class:: Parameter
.. class:: Parameter
(name, kind, \*, default=Parameter.empty, annotation=Parameter.empty)
Parameter objects are *immutable*. Instead of modifying a Parameter object,
Parameter objects are *immutable*. Instead of modifying a Parameter object,
you can use :meth:`Parameter.replace` to create a modified copy.
you can use :meth:`Parameter.replace` to create a modified copy.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment