4 ms·
I know what you are talking about in general, but most of the stuff in this library seems to either add clarity or help prevent errors. The problem of kwargs wh
by slaymaker1907 6y ago
I know what you are talking about in general, but most of the stuff in this library seems to either add clarity or help prevent errors. The problem of kwargs where you end up with a bunch of confusion on documentation is definitely a real thing.
Multiple dispatch is also a great thing as well. You don’t realize you need it until you try implementing something unification algorithm.
Compose is nice for reducing the mental overhead of reading nested expressions. However, I do wish they took a line from lodash and implemented flow instead (like compose but reversed so the first argument is invoked first, then the output of that is fed into the second, and so on).
Syntactic sugar is not bad if it increases signal to noise when reading code or if it prevents erroneous usage.
- marmaduke 6y agoOk 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.
- laminatedsmore 6y agoI think a python implementation of flow is in the toolz library as compose_left. I find myself often using the similar pipe function. - https://toolz.readthedocs.io/en/latest/api.html#toolz.functoolz.compose_left https://toolz.readthedocs.io/en/latest/api.html#toolz.functo... - https://toolz.readthedocs.io/en/latest/api.html#toolz.functoolz.pipe https://toolz.readthedocs.io/en/latest/api.html#toolz.functo...
- dragonwriter 6y agoTheres a lot of good stuff here (@delegates, partialler), sure, but then there's things like the extended Pathlib with pickle functionality; @typedispatch is a nice concept, but the multimethod seems to be more complete implementation of the concept that's been around much longer, so I'm not sure if there is a good case for it that I'm missing or it's just NIH.