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
elif type(item) in (list, set, tuple):
May be this checking is too narrow? It will be cool to make it more wide.
For example, let it to use any iterable Python-object.
The text was updated successfully, but these errors were encountered:
Looking into this, it seems I may be better off using the isinstance() function rather than the type() function. The advantage is that isinstance() recognizes the base class of derived classes, such that:
from collections import OrderedDict
test = OrderedDict({ 'foo': 'bar' })
type(test) == dict
False
isinstance(test, dict)
True
So if I test for isinstance(item, dict) the function will work for dict-like objects as well as pure dicts.
The text was updated successfully, but these errors were encountered: