3 ms·
Ok but what’s with the pre post meta init thing? Let’s see a junior run a debugger through that! Dropping one line of code costs several stack frames in your
by marmaduke 6y ago
Ok but what’s with the pre post meta init thing? Let’s see a junior run a debugger through that! Dropping one line of code costs several stack frames in your debug session.
- jph00 6y agoIt's a feature from the standard library. However it's only normally available in dataclass. fastcore simply brings the same functionality to other classes too.
- dragonwriter 6y agodataclass has __post_init__ as a mechanism for doing what you'd normally do in __init__ besides what dataclasses do in the generated __init__, because the generated __init__ means you can't do it in __init__, and otherwise you'd have to override (and replicate the function of) the generated __init__. It is not equivalent to PrePostMetaInit.