Implement typing.cast
This commit is contained in:
1 parent
8d24e35fa9
commit
5a6d8ba010
2 files changed
+18
-2
No files matched your search
@@ -351,3 +351,14 @@ def foo(a: typing.List, b: typing.Dict, c: typing.MutableMapping) -> typing.Type
|
||||
c['asdf']
|
||||
#? int
|
||||
foo()
|
||||
|
||||
def cast_tests():
|
||||
x = 3.0
|
||||
y = typing.cast(int, x)
|
||||
#? int()
|
||||
y
|
||||
return typing.cast(str, x)
|
||||
|
||||
|
||||
#? str()
|
||||
cast_tests()
|
||||
Reference in new issue
Block a user