Tidy up the matplotlib.__init__ documentation. #1950

Merged
merged 1 commit into from May 14, 2013

Conversation

Projects
None yet
4 participants
Member

pelson commented Apr 26, 2013

The matplotlib namespace is really cluttered. Many of the functions here could be static methods or instance methods of the RcParams dictionary class.

I don't want to hold up this PR, but if there is appetite to break backwards compatibility, I'd be willing to tidy it up in a follow-on PR.

Owner

mdboom commented Apr 30, 2013

Looks fine to me. I worry about keeping the manual list in matplotlib_configuration_api.rst up-to-date, but as you say, the only way to really fix that is to remove some things from __init__.py. Maybe we schedule that for post 1.3?

Member

pelson commented May 1, 2013

I worry about keeping the manual list in matplotlib_configuration_api.rst up-to-date

I empathise with that, but at the end of the day, if somebody adds new functionality to the matplotlib/__init__.py you would expect them to check that what they are adding is documented (as you would expect the reviewer to do also). So personally I'm comfortable with enumerating all of the necessary items in this special case.

Maybe we schedule that for post 1.3?

Hmmm. We could start the deprecation process for v1.3 potentially, and then have them removed in v1.4?

@efiring efiring commented on the diff May 1, 2013

lib/matplotlib/__init__.py
d = {}
- for root, dirs, files in os.walk(datapath):
+ for root, _, files in os.walk(datapath):
@efiring

efiring May 1, 2013

Owner

Just a style opinion, not a demand for change: I much prefer the original; the use of the bare underscore makes this sort of thing less readable and slightly ugly to my eye. In the case of the path.split(), an alternative is to index it with [-1].

@pelson

pelson May 1, 2013

Member

Ok. Thanks @efiring. I only did this because my editor was shouting at me that dirs was unused - the underscores use is not mentioned in PEP8 (though there is an interesting question on http://stackoverflow.com/questions/11486148/unused-variable-naming-in-python).

@NelleV

NelleV May 2, 2013

Contributor

I prefer the use of underscores: it makes explicit that those variable are not used in this file, which is a convention in python and some other languages (perl?). IMO, we should stick to convention as much as possible.

Also, that makes pyflakes not happy.

Owner

efiring commented May 1, 2013

@pelson, I agree with your original comment about the clutter in init.py. The API is a mess.

@pelson pelson added a commit that referenced this pull request May 14, 2013

@pelson pelson Merge pull request #1950 from pelson/matplotlib_doc
Tidy up the matplotlib.__init__ documentation.
c1a1079

@pelson pelson merged commit c1a1079 into matplotlib:master May 14, 2013

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment