4 ms·
Data classes are awesome! No more boilerplate __init__(self) methods needed. Another notable part of this release is type annotations: https://www.python.org/
by welder 8y ago
Data classes are awesome! No more boilerplate __init__(self) methods needed.
Another notable part of this release is type annotations:
https://www.python.org/dev/peps/pep-0560/ https://www.python.org/dev/peps/pep-0560/
- johnramsden 8y agoI love python typing, and have been using it extensively in 3.6. Great to see it in the CPython core! I've been looking forward to trying data classes, should be nice to avoid unnecessary code.
- kossae 8y ago> The typing module is one of the heaviest and slowest modules in the standard library even with all the optimizations made. Have you noticed any decreases in performance using core typing?
- kbd 8y agoFor those wondering, like I was, where that quote comes from, it's from PEP 560 "Core support for typing module and generic types" - https://www.python.org/dev/peps/pep-0560/ https://www.python.org/dev/peps/pep-0560/
- lysp 8y agoNot a python coder, but from my understanding they are essentially auto-constructors?
- extralego 8y agoTechnically, no, but that is how they are written. __init__ was always called after the instance was already created. I think it was originally useful for managing inheritance and baseclass initialization, which can be handled other less hard-coded ways now. I could be wrong.