You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.
> attr = AttrDict({'foo': [{'bar': 'baz'}, {'bar': 'qux'}]})
> for sub_attr in attr.foo:
> print(subattr.foo)
'baz'
'qux'
gets me NameError: name 'subattr' is not defined because of the missing underscore in subattr but it's also foo a second time, while it would need to be bar, i.e. making print(sub_attr.bar) for the body of the loop.
Further down the docs read:
> adict = AttrDict({'list': [{'value': 1}, {'value': 2}]}, recursive=False)
> for element in adict.list:
> isinstance(element, AttrDict)
False
False
But in ipython (with Python 2.7.13), I get this, instead:
In [29]: adict = AttrDict({'list': [{'value': 1}, {'value': 2}]}, recursive=False)
In [31]: [isinstance(element, AttrDict) for element in adict.list]
Out[31]: [True, True] # ???
I am unsure if recursive=False is not working as expected or if just the example is broken. Please enlighten me. Thanks!
PS: The second example seems to also miss use of print(...) for the examples to be consistent to each other.
The text was updated successfully, but these errors were encountered:
Hi!
There seem to be two bugs in the examples.
First, this example right off the docs
gets me
NameError: name 'subattr' is not defined
because of the missing underscore insubattr
but it's alsofoo
a second time, while it would need to bebar
, i.e. makingprint(sub_attr.bar)
for the body of the loop.Further down the docs read:
But in ipython (with Python 2.7.13), I get this, instead:
I am unsure if
recursive=False
is not working as expected or if just the example is broken. Please enlighten me. Thanks!PS: The second example seems to also miss use of
print(...)
for the examples to be consistent to each other.The text was updated successfully, but these errors were encountered: