4 ms·
If you're using Python 3.6, it's a lot easier now. You can do: from typing import NamedTuple class Point(NamedTuple): x: float y: float = 0.0 and the
by JelleZijlstra 9y ago
If you're using Python 3.6, it's a lot easier now. You can do:
from typing import NamedTuple
class Point(NamedTuple):
x: float
y: float = 0.0
and then Point(1.0).y == 0.0.
- sevensor 9y agoThat's quite nice!