diff --git a/pep-0362.txt b/pep-0362.txt index ba51c6ad4..afb751f79 100644 --- a/pep-0362.txt +++ b/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,14 +488,9 @@ 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_): - 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