PEP 483: Fix an example (#2143)
The body of one of the examples mistakenly used different names than the parameters given in the function signature.
This commit is contained in:
parent
7d90a862cb
commit
4109619130
|
@ -486,7 +486,7 @@ replaced by the most-derived base class among ``t1``, etc. Examples:
|
||||||
Note that the type checker will reject this function::
|
Note that the type checker will reject this function::
|
||||||
|
|
||||||
def concat(first: U, second: U) -> U:
|
def concat(first: U, second: U) -> U:
|
||||||
return x + y # Error: can't concatenate str and bytes
|
return first + second # Error: can't concatenate str and bytes
|
||||||
|
|
||||||
For such cases where parameters could change their types only simultaneously
|
For such cases where parameters could change their types only simultaneously
|
||||||
one should use constrained type variables.
|
one should use constrained type variables.
|
||||||
|
|
Loading…
Reference in New Issue