Hacker News new | ask | show | jobs
by welder 2918 days 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/

2 comments

I 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.

> 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?

For 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/
Not a python coder, but from my understanding they are essentially auto-constructors?
Technically, 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.