]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix issue #27402: example for typing did not type-check.
authorGuido van Rossum <guido@python.org>
Tue, 28 Jun 2016 17:08:17 +0000 (10:08 -0700)
committerGuido van Rossum <guido@python.org>
Tue, 28 Jun 2016 17:08:17 +0000 (10:08 -0700)
Doc/library/typing.rst

index 731e2eca16114d1d978a4e601ef7d0d2231078d8..317229de0cae126701d7371ccdc04ffd88d5faf0 100644 (file)
@@ -428,8 +428,8 @@ The module defines the following classes, functions and decorators:
       def vec2(x: T, y: T) -> List[T]:
           return [x, y]
 
-      def slice__to_4(vector: Sequence[T]) -> List[T]:
-          return vector[0:4]
+      def keep_positives(vector: Sequence[T]) -> List[T]:
+          return [item for item in vector if item > 0]
 
 .. class:: Set(set, MutableSet[T])