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
Conversation
@@ -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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 " |
There was a problem hiding this comment.
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.
DOC/MNT: Throwing some docstrings at axes_rgb.py
In my learning how to use axes_rgb.py, I ended up writing some
docstrings. Hope this is useful.