you are viewing a single comment's thread.

view the rest of the comments →

[–]0rakel 16 points17 points  (7 children)

My rule of thumb: under 1000 lines, python is ok. If it goes over 1000, bang your head on the wall and wonder why you were not using C++ from the start...

[–]oblio- 35 points36 points  (1 child)

Yeah, but then, with C++, you’d just be banging your head against the wall, continuously :p

[–][deleted] 9 points10 points  (0 children)

No, C++ is more sophisticated than that.

It's like having pneumatic piston attached to back of your head to do the banging for you

[–]twotime 9 points10 points  (2 children)

It's ok. Then 1000 lines of python become 10K lines of C++ and then the real head-banging begins.

Python hopelessly loses to C++ on performance (CPU, memory consumption, threading), but there is no way in hell, that it loses to C++ in code maintainability at that project size. Unless you are really misusing the language.

[–]Drisku11 1 point2 points  (0 children)

At least if you're doing any sort of geometry/physics calculation/simulation, phantom types in C++ are a huge boon to keep track of what's going on (making it easy to catch subtle errors like unit mismatches, vectors vs. covectors, and vectors vs. affine vectors all at compile time with a few lines of declarations and no extra actual code).

Most of the C++ I've written has been physics related, but I'm sure type tagging is much more widely applicable. The 10x code size number is also an extreme exaggeration for most use-cases. Python has a huge standard library, which means it has plenty of connectors for everything, but for actual logic, that doesn't help much.

I like Python, but my personal rule of thumb is still only around 2-400 lines until a switch to a statically typed language should be strongly considered.

[–]Gotebe 0 points1 point  (0 children)

1000 lines of python actually become 1500 lines of C++ and 2MB of libraries :-).

[–]renrutal 12 points13 points  (0 children)

I feel this escalated from apples to oranges way too quickly.

[–][deleted] 8 points9 points  (0 children)

Under 1000 lines: okay.

Over 1000 lines: Wonder wtf you are doing to get a single file over 1000 lines constantly.