Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC/MNT: Throwing some docstrings at axes_rgb.py #4564

Merged
merged 7 commits into from Jul 1, 2015
Merged

DOC/MNT: Throwing some docstrings at axes_rgb.py #4564

merged 7 commits into from Jul 1, 2015

Conversation

ericdill
Copy link
Contributor

In my learning how to use axes_rgb.py, I ended up writing some
docstrings. Hope this is useful.

@tacaswell tacaswell added this to the next point release milestone Jun 27, 2015
@@ -33,10 +33,12 @@ def __init__(self, axes):

def __getitem__(self, k):
if isinstance(k, tuple):
r = SimpleChainedObjects([dict.__getitem__(self, k1) for k1 in k])
r = SimpleChainedObjects(
[super(Axes.AxisDict, self).__getitem__(self, k1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super(cls, self) returns the bound method so you don't need the second self.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't I also just do super(Axes.AxisDict, self)[k1] here? dict subclassing is still a mystery to me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, super()[k] would also work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any preference?

In my learning how to use axes_rgb.py, I ended up writing some
docstrings. Hope this is useful.
Fixed a sloppy copy/paste in py2/py3 compatible reraising
Not entirely clear on what the code at the bottom of
lib/mpl_toolkits/axes_grid1/mpl_axes.py is supposed to do, but at
least it will run now...
try:
axes_class = kwargs.pop("axes_class", self._defaultAxesClass)
except AttributeError:
new_msg = ("A subclass of RGBAxesBase must have a "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm. _defaultAxesClass is private, in general I'm not in favour of this defensive style, but I accept that this message would have been very helpful for you at some point. I wont hold the PR up for this though.

pelson added a commit that referenced this pull request Jul 1, 2015
DOC/MNT: Throwing some docstrings at axes_rgb.py
@pelson pelson merged commit d1e0709 into matplotlib:master Jul 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants