Python Forum

Full Version: General question about serialization/deserialization in python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi first post!

I am currently developing an Ecommerce website and decided to try flask. I am more familiar with java but have some experience writing simpler scripts with python. However i have newer created a full application with python.

When using python for a larger project i have gotten a bit confused. If i would create the same application with java i would use objects within the program and then serialize/deserialize them when using databases and cookies etc. But this is not as straightforward with python. For example there is no simple library to use when you serialize/deserialize objects to use with a mongo database.

This makes me believe that this is not the pythonic way to do things. I could ofcourse write my own code for serialization/deserialization to dicts and other formats. But this seems to complicated since the objects is large and nested. It would be easier to just pass around dicts within the program then writing complicated serialization/deserialization logic, but this also seems wrong.

So therefore i ask you experienced pythonistas out there - What is it that i am not getting about python and serialization/deserialization?

Please note that i am not asking which library to use to convert python objects to mongo documents. I am asking for what i have not understod about python since the support for this type of serialization/deserialization is so limited.
I'd start with a Flask tutorial, and get used to the way it's done in python.
A good one is: https://blog.miguelgrinberg.com/post/the...ello-world