-
Notifications
You must be signed in to change notification settings - Fork 5
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
__contains__ pollutes __dict__ with empty Namespace values #14
Comments
Good find. I'll see if I can get a patch fix published this week unless you want to PR earlier. |
I'm a bit flat out right now. I may be able to get to it in a week or so. |
This seems to have fixed things for me but wanted your opinion on whether this is the right fix or not. What do you think? def __contains__(self, name):
names = name.split('.')
obj = self
for name in names:
obj = getattr(obj, name)
if isinstance(obj, Namespace):
if obj.__dict__:
return True
else:
del self.__dict__[name] # <--- I added this line
return False
else:
return True |
@christian-storm This is fixed in master. Apologies for the long delay, GitHub notifications suck. |
Doesn't it make sense that 'e' would only be added in assignment and not in attribute lookup/contains?
The reason I found this was because I added a method knitems
to be able to iterate one level at a time. I've had to add
in order to make it work.
The text was updated successfully, but these errors were encountered: