The author has created a pseudo-class out of the module. There is still a family of functions operating on the same exact data. All that he has done is throw away the init and require more imports.
Given that python is an object oriented language, the correct abstraction for this pseudo-class is... a class.
As others have already pointed out, the example would benefit from a refactor that separates concerns but this so-called "functional" approach makes that harder to accomplish if these functions have been peppered throughout the codebase.
I'm tired of people making trivial arrangements to a codebase like this and calling it "functional", losing most of the OOP benefits of python in the process. Maybe stop rearranging the chairs and get on with sailing the ship.
> stop rearranging the chairs and get on with sailing the ship
I had never heard this before (though it even has a wiktionary entry), what a beautiful way to put it, thank you. It's really ridiculous, the amount of time we waste on readable, testable implementations with enough performance, just because they're not the proper version of an idea in the reviewer's mind.
It's not what DDD says! This is not how Scrum works! That's not functional programming! These aren't real unit tests!
One thing in common I notice in this sort of pointless bickering is that how they're always about how "X is not real/proper Y", and they almost never point out an actual antipattern you might need to avoid due to reasons. The argument is purely philosophical from the very beginning, without much thought on what the implications are, if any.
And I'm beginning to attribute this to incompetence. Not always -- there is always that one colleague who's a genius thinker in one dimension, not quite focused on delivery, and that's fine. We all need the occasional course correction, we all stand on the shoulders of giants. But it's often enough that I feel I'm expected to give one of those acronyms, just so that the other person can use a preset line of scrutiny: nevermind paying any attention to whether the tests actually validate the program, or if the design is unambigous and extensible, etc.
It's like a version of the "factory worker"-style developer -- you know, he who exists to be a pseudocode-to-actualcode translator, always expects a perfectly well-defined set of specs, a design to implement that within, and won't move a muscle except to complain about how everyone else isn't doing their job unless those are all satisfied. Yes, it's exhausting.
Thank you for accommodating my rant if you read this far, dear reader; thank you OP for bringing out the salt I didn't realize I had today! Apologies if I digressed too far there.
Given that python is an object oriented language, the correct abstraction for this pseudo-class is... a class.
As others have already pointed out, the example would benefit from a refactor that separates concerns but this so-called "functional" approach makes that harder to accomplish if these functions have been peppered throughout the codebase.
I'm tired of people making trivial arrangements to a codebase like this and calling it "functional", losing most of the OOP benefits of python in the process. Maybe stop rearranging the chairs and get on with sailing the ship.
Maybe I'm just a little salty today. ¯\_(ツ)_/¯