Re:Fastcore: A library that extends Python with new features
by marmaduke on Saturday September 05, 2020 @04:44PM
(#24386715)
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.
[ Parent
| on HN ]
Re:Fastcore: A library that extends Python with new features
by jph00 on Saturday September 05, 2020 @05:20PM
(#24386925)
It'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.
Re:Fastcore: A library that extends Python with new features
by dragonwriter on Monday September 07, 2020 @08:12PM
(#24404017)
dataclass 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.