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
Using help (?
) with default_box=True
unintentionally adds a key
#236
Labels
Comments
Ok, I've found a workaround for now - from box import Box
class MyBox(Box):
_protected_keys = dir(Box) + ['getdoc']
def getdoc(self):
return Box.__doc__ |
cdgriffith
added a commit
that referenced
this issue
Jan 28, 2023
…key (thanks to Nishikant Parmar) Fixing union operations from creating dicts instead of Boxes on certain python versions. Readme and setup updates
cdgriffith
added a commit
that referenced
this issue
Jan 28, 2023
…te keys (thanks to Rexbard) * Adding #236 iPython detection to prevent adding attribute lookup words (thanks to Nishikant Parmar) * Adding new DDBox class (Default Dots Box) that is a subclass of SBox
Merged
Hopefully fixing both Adding this feature in Box 7! Please test and give feedback if possible |
cdgriffith
added a commit
that referenced
this issue
Feb 4, 2023
* Adding #169 default functions with the box_instance and key parameter (thanks to Коптев Роман Викторович) * Adding #170 Be able to initialize with a flattened dict - by using DDBox (thanks to Ash A.) * Adding #192 box_dots treats all keys with periods in them as separate keys (thanks to Rexbard) * Adding #211 support for properties and setters in subclasses (thanks to Serge Lu and David Aronchick) * Adding #226 namespace to track changes to the box (thanks to Jacob Hayes) * Adding #236 iPython detection to prevent adding attribute lookup words (thanks to Nishikant Parmar) * Adding #238 allow ``|`` and ``+`` for frozen boxes (thanks to Peter B) * Adding new DDBox class (Default Dots Box) that is a subclass of SBox * Fixing #235 how ``|`` and ``+`` updates were performed for right operations (thanks to aviveh21) * Fixing #234 typos (thanks to Martin Schorfmann) * Fixing no implicit optionals with type hinting
Added in 7.0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Box is really useful when accessing non-existing keys/attributes and assigning new keys on them e.g.
box.foo.bar.baz = 1
.Noting down here an issue I have found. When IPython's help using
?
is called it adds a keygetdoc
in Box object.Version
python-box v6.1.0
Reproducer
Cause
This seems expected and is a side-effect of this line in IPython which tries a find a custom method
getdoc()
to get docstring for an object.Is there a workaround here?
The text was updated successfully, but these errors were encountered: