-
Notifications
You must be signed in to change notification settings - Fork 132
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
__getitem__ subclassing issue for new 2.2.0 #107
Comments
Hi, any update? |
Hey Steven, Please see this discussion to see if it helps resolve your issue #101. If it doesn't please ping me again! |
Hi @yhhsteven, The difference between addict 2.2.0 and 2.1.3 is that passing a missing key to |
@MisterVladimir @mewwts Thanks for your contributing! I like the idea changed in 2.2.0. I'm using the missing style right now. However, I ran into a problem when implement addict in this way, I'd like know if there is a better way to change my code:
This intends to design a custom attribute I wonder if the addict's missing should add an AttributeError instead, for a better exception handling, or should I change my code to more correct way when subclassing addict? Thank you and happy new year! |
Happy new year @yhhsteven, If you only want to use addict as an attribute dict perhaps you should instead make a class like class D:
def __init__(self, x):
self.attrs = addict.Dict()
self.x = x and then use it like Thanks for using |
Hi I want to say thank you first as I used a lot addict, it's a very nice module!
I upgraded from 2.1.3 to 2.2.0 and encountered this problem:
My code:
The same code was working perfectly fine with 2.1.3. But for 2.2.0, it has to be solved by:
out = super(PLAYER, self).get( name, {})
However, I wonder if I were wrong at beginning . Since it is stated that 2.2.0 has been improved for better subclassing, please let me know any better subclassing suggestion for the same purpose. The goal is simple: if there was a missing key in PLAYER, return key from PLAYERDB object.
Sorry for my English. Thanks for your help!
The text was updated successfully, but these errors were encountered: