3 ms·
Lots of people saying "nobody does this is real life". I have. My PhD code (which was too slow and RAM-hungry, having been written in Python...) was a monster,
by tehwalrus 10y ago
Lots of people saying "nobody does this is real life". I have.
My PhD code (which was too slow and RAM-hungry, having been written in Python...) was a monster, and was a lot less of a monster for order-2 and order-3 nested list/dict comps.
It started out as a 200 line proof of concept (which worked perfectly on an ideal of the system I was studying), and it evolved into a 6,000 line behemoth (~2,000 lines for OpenGL rendering error cases) which would have been 10,000 lines without nested list and dict comps.
By the way, never use networkx on anything you expect to have a large number of vertices or edges. It uses a lot of RAM (esp in undirected graphs where you have backrefs for each edge.) Wrap a C++ graph lib like boost::graphs or something, and code against that interface from the beginning.
- gspetr 10y agoI have not used networkx on anything serious, but this article lead me to believe that it is to be avoided, since the library missed obvious Python optimizations: https://mathieularose.com/choosing-the-right-data-structures/ https://mathieularose.com/choosing-the-right-data-structures...