-
Notifications
You must be signed in to change notification settings - Fork 54
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
Added collections of named colormaps, attribute access #5
Conversation
Also fixes #4, sorting the named dictionaries so that options are in a good order in the above list. |
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.
One small comment otherwise this looks good.
assets/CET_to_py.py
Outdated
"""Ordered dictionary with attribute access (e.g. for tab completion)""" | ||
def __getattr__(self, name): return self[name] | ||
def __delattr__(self, name): del self[name] | ||
def __setattr__(self, name, value): self[name] = value |
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.
Should this also have a __dir__
method for tab completion or would that be too cluttered:
def __dir__(self): return self.keys()
colorcet/__init__.py
Outdated
"""Ordered dictionary with attribute access (e.g. for tab completion)""" | ||
def __getattr__(self, name): return self[name] | ||
def __delattr__(self, name): del self[name] | ||
def __setattr__(self, name, value): self[name] = value |
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.
Comment above probably applies more here, a __dir__
might be nice.
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.
The first one is the source code for the second one, so sure, I'll add that. Thanks!
Misc collected fixes/improvements:
Example of those last two: