Minor corrections in PEP 362, sent by Yury Selivanov.
This commit is contained in:
parent
32f1e342b4
commit
151209a801
13
pep-0362.txt
13
pep-0362.txt
|
@ -176,7 +176,7 @@ A Parameter object has the following public attributes and methods:
|
|||
|
||||
* ``Parameter.VAR_KEYWORD`` - a dict of keyword arguments
|
||||
that aren't bound to any other parameter. This corresponds
|
||||
to a "\*\*kwds" parameter in a Python function definition.
|
||||
to a "\*\*kwargs" parameter in a Python function definition.
|
||||
|
||||
Always use ``Parameter.*`` constants for setting and checking
|
||||
value of the ``kind`` attribute.
|
||||
|
@ -391,9 +391,9 @@ Let's define some classes and functions:
|
|||
|
||||
def decorator(f):
|
||||
@wraps(f)
|
||||
def wrapper(*args, **kwds):
|
||||
def wrapper(*args, **kwargs):
|
||||
full_args = shared_args + args
|
||||
return f(*full_args, **kwds)
|
||||
return f(*full_args, **kwargs)
|
||||
|
||||
# Override signature
|
||||
sig = signature(f)
|
||||
|
@ -488,12 +488,7 @@ Annotation Checker
|
|||
|
||||
# If the argument has a type specified, let's check that its
|
||||
# default value (if present) conforms with the type.
|
||||
try:
|
||||
default = param.default
|
||||
except AttributeError:
|
||||
continue
|
||||
else:
|
||||
if not isinstance(default, type_):
|
||||
if param.default is not param.empty and not isinstance(param.default, type_):
|
||||
raise ValueError("{func}: wrong type of a default value for {arg!r}". \
|
||||
format(func=func.__qualname__, arg=param.name))
|
||||
|
||||
|
|
Loading…
Reference in New Issue