作者:ytdytduyufy_100 | 来源:互联网 | 2023-10-14 16:31
Because Marshmallow provides a nice abstraction over the datamodel, it might be nice to go even further and use something like DotMap (https://github.com/drgrib/dotmap) to simplify using the objects.
E.g. instead of
1
| user['created_at'] |
you could type:
This also provides the benefit of giving you a layer to prevent messing with the object (instead of with a visible dict data structure, where it feels like it's more open to interference).
该提问来源于开源项目:marshmallow-code/marshmallow
Check out
.
https://docs.python.org/3/reference/datamodel.html#object.getitem