Skip to content

Commit 537fc55

Browse files
authored
Fix example to use correct method of Stack (#19123)
This PR updates the `generics.rst` documentation to correct a method call in the `Stack` usage example. Previously, the example incorrectly used `.append('x')` on a `Stack[str]` instance, which is not a valid method for the `Stack` class.
1 parent 9b5b410 commit 537fc55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/source/generics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Using ``Stack`` is similar to built-in container types:
9393
stack.push('x')
9494
9595
stack2: Stack[str] = Stack()
96-
stack2.append('x')
96+
stack2.push('x')
9797
9898
Construction of instances of generic types is type checked (Python 3.12 syntax):
9999

0 commit comments

Comments
 (0)