[Python-ideas] Issues with inspect.Parameter

Antony Lee antony.lee at berkeley.edu
Sun Nov 10 09:41:10 CET 2013


The docstring of inspect.Parameter indicates the "default" and "annotation"
attributes are not set if the parameter does not have, respectively, a
default value and an annotation, and that the "kind" attribute is a string.
But in fact, the "default" and "annotation" attributes are set to
"inspect._empty (== Parameter.empty)" in that case, and the "kind"
attribute has type "_ParameterKind" (essentially a hand-written equivalent
of IntEnum).  I suggest to correct the docstring accordingly, and to
replace the implementation of _ParameterKind by a proper IntEnum (if full
backwards compatibility is required), or even just by Enum (which makes a
bit more sense, as the fact that _ParameterKind is a subclass of int
doesn't seem to be documented anywhere).
Antony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131110/1490f89d/attachment.html>


More information about the Python-ideas mailing list