Created
July 6, 2020 13:55
-
-
Save tmastny/17f03c7fbd32549c7dc14d2cc3d8a8d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# References: | |
# https://ipython.readthedocs.io/en/stable/config/integrating.html | |
# https://stackoverflow.com/questions/17974777/tab-complete-dictionary-keys-in-ipython | |
class Shape2(): | |
area = 1 | |
perimeter = 1 | |
location = 1 | |
def __getitem__(self, key): | |
return getattr(self, key) | |
def _ipython_key_completions_(self): | |
return ["area", "perimeter", "location"] | |
s = Shape2() | |
# in ipython/jupyter type | |
# s["lo<TAB> | |
# to autocomplete | |
s["location"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment