This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Hard: | |
| pass | |
| class Soft: | |
| pass | |
| lst: list[Hard] | list[Soft] | |
| lst = [val for val in lst] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Hard: | |
| pass | |
| class Soft: | |
| pass | |
| lst: list[Hard] | list[Soft] | |
| lst = [val for val in lst] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Iterator | |
| def fib(n: int) -> Iterator[int]: | |
| a, b = 0, 1 | |
| while a < n: | |
| yield a | |
| a, b = b, a + b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Iterator, Literal | |
| def fib[T: Literal[10,11]](n: T) -> Iterator[int]: | |
| a, b = 0, 1 | |
| while a < n: | |
| yield a | |
| a, b = b, a + b | |
| fib[10](10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def f(x, y) -> None: | |
| z: str = 0 | |
| reveal_type((x, y)) | |
| def g(x: int, y: str): | |
| z: str = 0 | |
| reveal_type((x, y)) | |
| def h(x, y): | |
| z: str = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import typing | |
| class P(typing.Protocol): | |
| def foo(self, a: int) -> None: ... | |
| class C: | |
| def foo(self, *args: int) -> None: pass | |
| def f(o: P) -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import typing | |
| class P(typing.Protocol): | |
| def foo(self, a: int) -> None: ... | |
| class C: | |
| def foo(self, *args: int) -> None: pass | |
| def f(o: P) -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import typing | |
| class P(typing.Protocol): | |
| def foo(self, a: int) -> None: ... | |
| class C: | |
| def foo(self, *args: int) -> None: pass | |
| def f(o: P) -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Iterator | |
| def fib(n: int) -> Iterator[int]: | |
| a, b = 0, 1 | |
| while a < n: | |
| yield a | |
| a, b = b, a + b |
NewerOlder