Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



That's quite nice!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: