clumper
clumper copied to clipboard
Avoiding class methods to simplify API usage
Is your feature request related to a problem? Please describe. Looking at the API, it does look a bit odd to me that one needs to call a class method (and import the class) to read files. Is there a need for the class object? From a style perspective, calling class methods breaks with the otherwise very functional method style of the other parts of the lib (e.g. chaining).
Describe the solution you'd like
import clumper
clump = clumper.read_json('https://calmcode.io/datasets/pokemon.json')
It's a fair observation.
Originally I had the idea that there may be different types of Clumper
objects in the future. The functional style that I have here is nice, but it does come at a performance cost. There's something to be said for a Clumper
that is based on generators, which can be designed to be more lazy. Now, a few months later, I wonder if I'll ever really be able to get to that.
I'll keep this idea in mind for a 1.0
release.