3 ms·
> It's unfortunate that people nitpick them, because the alternative is long and complicated examples that can't be understood at a glance. If the examples don
by nemetroid 5y ago
> It's unfortunate that people nitpick them, because the alternative is long and complicated examples that can't be understood at a glance.
If the examples don’t show cases where the feature even arguably is the best option, they’re bad examples of the feature. I don’t think that’s nitpicking.
- klyrs 5y agoThe operator module is not something most python developers will ever need. It's a collection of very low-level tools that will rarely, if ever, be the right choice in a small code snippet. Can we even talk about the existence of these functions in an easy-to-read blog post, if the only 'right way' to use them is a full-blown DSL parser or whatever? Or, can we trust the reader to not run home and refactor their arithmetic to #this used to be y = 2 * x + 1 until I read a sweet blog y = operator.add(1, operator.mul(2, x)) I really don't see any danger of that, myself.