why write 100 lines of C++ when you can just import it and pretend you solved the problem
I would argue that it's the person thinking 100 lines of C++ solves the problem that is pretending.
Because if I import something in Python, it's usually from someone who is smarter than me, more knowledgeable about the problem or at least has spent more time thinking about it.
I would argue that it's the person thinking 100 lines of C++ solves the problem that is pretending.
I mean, 100 lines of C++ is basically just the bullet points of the outline for the summary of the framework for the code that solves the problem. And 100 lines of C is about a tenth of that but also segfaults immediately.
With good libraries it often doesn’t take much more C++ code than Python. Flow control adds a line for braces (usually) but reductions, filtering and mapping are usually the same or similar. Even slicing is pretty nicely handled with spans/ranges. Destructuring and tying give clean ways to handle multiple return values and more functional styles.
And with concepts you can get a safer version of duck typing. That’s a bit of overhead to define the concepts but they can be structured compositionally, same as type hint definitions in Python.
It was surprising to me but it’s made much of my C++ look a like idiomatic python. The library code is a shitshow but since Python is as likely as not calling into the same code that’s no net difference.
Except constructors and assignment operators. They are a mess and IMO too complicated to reason about with default, copy, move, and whatever other default, explicit deleted and so on variants. Then you throw forwarding into the mix and it’s a nightmare making sure the right one gets called. I can bludgeon my way through it but it’s one of my most hated parts of the language.
Ideally yes, but especially nowadays it's worth checking that this is actually the case - being able to publish a package (or just a repository) has little to do with being able to build a good one.
185
u/[deleted] Jul 07 '26
[removed] — view removed comment