Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
JelleZijlstra
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
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.
2.
▲
by
JelleZijlstra
9y ago
It's not actually; typing.NamedTuple is just a wrapper that calls the original collections.namedtuple. It does provide some additional features, like default values and methods.