- class asobj(obj, strict=True)[source]#
Convert any object for which you would normally do
a['b']to one where you can do
Note: this may lead to unexpected behavior in some cases. Use at your own risk. At minimum, objects created using this function have an extremely odd type – namely
obj (anything) – the object you want to convert
strict (bool) – whether to raise an exception if an attribute is being set (instead of a key)
d = dict(foo=1, bar=2) d_obj = sc.asobj(d) d_obj.foo = 10
New in version 1.0.0.