From 224c9c1f49d5746a7f0004829b72c14b959a0e44 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 30 Jan 2014 00:12:02 -0500 Subject: inspect.docs: Document constructors for Signature & Parameter #20442 --- Doc/library/inspect.rst | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 7612544..d4cf905 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -435,12 +435,21 @@ function. 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 annotation. For each parameter accepted by the function it stores a :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 modified copy. @@ -489,7 +498,7 @@ function. "(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, you can use :meth:`Parameter.replace` to create a modified copy. -- cgit v0.12 From 844dcfbf59b6c26ade093a9801cf454554fc0e57 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Wed, 29 Jan 2014 22:59:34 -0800 Subject: Remove issue 19081 Misc/NEWS entry since it isn't entirely fixed yet. --- Misc/NEWS | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 8b24dc3..5a84af8 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -24,11 +24,6 @@ Core and Builtins source encoding declarations, and can be used to make Python batch files on Windows. -- Issue #19081: When a zipimport .zip file in sys.path being imported from - is modified during the lifetime of the Python process after zipimport has - already cached the zip's table of contents we detect this and recover - rather than read bad data from the .zip (causing odd import errors). - - Issue #17432: Drop UCS2 from names of Unicode functions in python3.def. - Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c" -- cgit v0.12