dict (bool, default False) – Whether instances of this type will include a dict. Setting this to True will allow adding additional undeclared attributes to a struct instance, which may be useful for holding private runtime state. Defaults to False.
I am still abit confused as to how this works. Does it mean to say that at decoding, let's say from json bytes, any field that is not in __struct_fields__ will be put under __dict__? Or does it only mean that classes created under Struct(dict=True) will have an additional __dict__ attribute?
I believe it might be the second scenario at this point, but I am still asking this just in case I misunderstand anything.
Question
From the documentation:
dict (bool, default False) – Whether instances of this type will include a dict. Setting this to True will allow adding additional undeclared attributes to a struct instance, which may be useful for holding private runtime state. Defaults to False.
I am still abit confused as to how this works. Does it mean to say that at decoding, let's say from json bytes, any field that is not in
__struct_fields__
will be put under__dict__
? Or does it only mean that classes created under Struct(dict=True) will have an additional__dict__
attribute?I believe it might be the second scenario at this point, but I am still asking this just in case I misunderstand anything.
Thanks