Skip to content

Commit 132dfa2

Browse files
elias6gvanrossum
authored andcommitted
Clarify generic function documentation (#4618)
This explains that a variable of a generic type must be able to be resolved to a non-generic type, hopefully preventing the confusion that made me (and possibly others) think #4590 is a bug.
1 parent 509866e commit 132dfa2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/source/generics.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ example we use the same type variable in two generic functions:
228228
def last(seq: Sequence[T]) -> T:
229229
return seq[-1]
230230
231+
A variable cannot have a type variable in its type unless the type
232+
variable is bound in a containing generic class or function.
233+
231234
.. _generic-methods-and-generic-self:
232235

233236
Generic methods and generic self

0 commit comments

Comments
 (0)