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 Connection: | |
| def __init__(self): | |
| ... | |
| def __enter__(self): | |
| ... | |
| def __exit__(self, type, value, traceback): | |
| ... | |
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 foo(*, a, b): | |
| pass | |
| foo(a="a", b="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
| import itertools | |
| # NOTE: this will consume all items up until the start of slice | |
| # and also all the items in islice object | |
| s = itertools.islice(range(50), 10, 20) | |
| for val in s: | |
| ... |
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
| user_input = "This\nstring has\tsome whitespaces...\r\n" | |
| character_map = { | |
| ord('\n') : ' ', | |
| ord('\t') : ' ', | |
| ord('\r') : None | |
| } | |
| user_input.translate(character_map) |