Easter-egg 𝜋thon only for 3.14
def foo(x: int = 3, y: MyType = None) -> float:
pass
class MyType:
pass
foo_y_annotation = foo.__annotations__['y']TODO
name = "ML team"
template = t"Here is a cookie for {name}"
print(template)from compression import zstd
data = bytes(...)
compressed_zstd = zstd.compress(data)python -m asyncio ps PID
python -m asyncio pstree PID
python -m asyncio ps 12345
tid task id task name coroutine stack awaiter chain awaiter name awaiter id
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1935500 0x7fc930c18050 Task-1 TaskGroup._aexit -> TaskGroup.__aexit__ -> main 0x0
1935500 0x7fc930c18230 Sundowning TaskGroup._aexit -> TaskGroup.__aexit__ -> album TaskGroup._aexit -> TaskGroup.__aexit__ -> main Task-1 0x7fc930c18050
1935500 0x7fc93173fa50 TMBTE TaskGroup._aexit -> TaskGroup.__aexit__ -> album TaskGroup._aexit -> TaskGroup.__aexit__ -> main Task-1 0x7fc930c18050
1935500 0x7fc93173fdf0 TNDNBTG sleep -> play TaskGroup._aexit -> TaskGroup.__aexit__ -> album Sundowning 0x7fc930c18230
1935500 0x7fc930d32510 Levitate sleep -> play TaskGroup._aexit -> TaskGroup.__aexit__ -> album Sundowning 0x7fc930c18230
1935500 0x7fc930d32890 DYWTYLM sleep -> play TaskGroup._aexit -> TaskGroup.__aexit__ -> album TMBTE 0x7fc93173fa50
1935500 0x7fc93161ec30 Aqua Regia sleep -> play except* is from Python 3.10 to unpack exceptions
try:
connect_to_server()
except TimeoutError, ConnectionRefusedError:
print('The network has ceased to be!')def f():
try:
pass
except:
return 0
finally:
return 1
> SyntaxWarning: 'return' in a 'finally' blockThe cycle garbage collector is now incremental. This means that maximum pause times are reduced by an order of magnitude or more for larger heaps.
There are now only two generations: young and old. When gc.collect() is not called directly, the GC is invoked a little less frequently. When invoked, it collects the young generation and an increment of the old generation, instead of collecting one or more generations.
Changed in version 3.14: generation=1 performs an increment of collection.
Other calls to gc.collect() are unchanged.