[Python-checkins] peps: Minor corrections in PEP 362, sent by Yury Selivanov.
andrew.svetlov
python-checkins at python.org
Mon Aug 13 20:31:59 CEST 2012
http://hg.python.org/peps/rev/872b93d9b814
changeset: 4500:872b93d9b814
user: Andrew Svetlov <andrew.svetlov at gmail.com>
date: Mon Aug 13 21:31:39 2012 +0300
summary:
Minor corrections in PEP 362, sent by Yury Selivanov.
files:
pep-0362.txt | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/pep-0362.txt b/pep-0362.txt
--- a/pep-0362.txt
+++ b/pep-0362.txt
@@ -176,7 +176,7 @@
* ``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 @@
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,14 +488,9 @@
# 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_):
- raise ValueError("{func}: wrong type of a default value for {arg!r}". \
- format(func=func.__qualname__, arg=param.name))
+ 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))
def check_type(sig, arg_name, arg_type, arg_value):
# Internal function that encapsulates arguments type checking
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list