2 ms·
Thanks for the reply and insight. Why you had issues with magic in Python libraries, as I understand one of the main design goals of Python and its libraries i
by dragonsh 10y ago
Thanks for the reply and insight.
Why you had issues with magic in Python libraries, as I understand one of the main design goals of Python and its libraries is "Explicit is better then implicit" PEP-20 [1].
Indeed for our own project we chose python instead of ruby and ruby on rails just because of this PEP-20[1].
Your blog and moving to go alarmed us if there is anything wrong with python eco-system.
We tried go and due to too much boilerplate code and quality of the libraries we dropped it and when it comes to interacting with database especially postgreSQL all the speed advantage of go is not very useful as most tasks were IO intensive. Also the database driver in golang for postgresql is not as mature as psycopg. For CPU intensive tasks we relied on scientific python which is written in C and it worked well with multiprocessing and asyncio in python.
Also for the specific error you encountered in race conditions on update with multiple request. We solved it by using SQLAlchemy with_for_update()[2] which actually takes care at database level to make sure transactions are properly handled. As database we were using is postgreSQL, we wanted the database to handle ACID compliance, not implement in application code.
[1]https://www.python.org/dev/peps/pep-0020/ https://www.python.org/dev/peps/pep-0020/
[2]http://docs.sqlalchemy.org/en/latest/core/selectable.html#sqlalchemy.sql.expression.Select.with_for_update http://docs.sqlalchemy.org/en/latest/core/selectable.html#sq...