tgherzog / wbgapi

Python module that makes using the World Bank's API a lot easier and more intuitive.
MIT License
140 stars 31 forks source link

More object-oriented UI #8

Closed tgherzog closed 4 years ago

tgherzog commented 4 years ago

I think the interface should be more object oriented. This would be more intuitive particularly for things like regions and the economy coder, be more consistent with pandas, and make it easier to integrate with iPython (e.g., formatted output). But I want to take some time to think through a comprehensive approach.

In most cases this would mean returning objects that subclasses an iterable, like a dict or set, or maybe a Pandas dataframe or series, which adds custom __repr__ and _repr_html_ classes.

So for instance:

tgherzog commented 4 years ago

Deciding not to do the region(x).members interface as it's not intuitive for passing lists of regions, e.g., income.members(['HIC', 'LIC']) (would one call get or list in this instance?)