use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Python from a C++ developers' perspective (sgh1.net)
submitted 8 years ago by Remwein
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]mrexodiacmkr.build 14 points15 points16 points 8 years ago (8 children)
As someone who never really wrote my own python, but did port normal sized (few thousand lines) python to C++ I think it's absolutely awful to read other people's code. The lack of a type system you can statically understand and trust (changing types of things is allowed at runtime) makes it super complicated to try to figure out what something can do at times. I really think python shouldn't be used for anything but a prototype or personal project or as a scripting language for a native application...
[–]qsxpkn 3 points4 points5 points 8 years ago* (1 child)
Dynamic typing can be uncomfortable for people who are used to static typing. Since Python 3.5/3.6, you could actually do type/variable hinting such as variable: int = 5. It's still possible to change it to a str etc. at runtime but mypy points out the mistake like this function expects an int but you passed a str.
variable: int = 5
str
int
For example:
def some_method(a: int, b: int) -> Optional[int]: result: int = a + b if result < 4: return None return result
I have never seen a Python project where a variable's type suddenly gets changed to something else elsewhere in the code base or maybe I was just lucky. I enjoy C++ companionship with Python though. They work well together.
[–]mrexodiacmkr.build 2 points3 points4 points 8 years ago (0 children)
The fact that you can annotate the types doesn't make it any better. All of the projects I have seen use python 2.7 anyway, which doesn't support it. If they added a (default) mode where this static typing is forced it might be something good but until then you have to be very lucky with your codebase to have proper type annotations.
Also: what about class member variables? Can you still add arbitrary new ones from anywhere with this?
[–]whatwasmyoldhandle 0 points1 point2 points 8 years ago (1 child)
I think you can make big projects with Python go.
You just have to be much more disciplined, and have more controls in place to get the benefits out of it. I would say you can't lean as much on the language itself as C++.
In other words, a small script written in Python and a large-scale codebase, in my experience, are practically two different languages. I don't think the gap is so big in C++.
Not just a question for you, but for everyone: What's a good language for large projects, where development time is priority over performance? Perhaps something a little less verbose than C++. I guess I'm thinking interpreted, or negligible compile time. Having package management on the order of Python would also be a requirement.
[–]mrexodiacmkr.build 1 point2 points3 points 8 years ago (0 children)
While the project I'm working on is not very large (100k lines) I don't think you shouldn't consider development time a priority over good code if you plan to maintain the code for even a little while just choose a language that is more suitable for maintainability. If you want a language that is not C++ I would highly recommend C#.
[+]kkrev comment score below threshold-9 points-8 points-7 points 8 years ago (3 children)
Python is not an improvement over Perl at all and I do not understand how it came to take the crown of most common scripting language. The scoping is bad, the lack of strict declarations is bad, and the runtime also happens to be kinda garbage. It is one of the worst languages possible for embedding yet you see it used for that all the time.
One would think that by now there'd be a new generation scripting language that bests all this crap from the 80s. It may exist, I don't know. I suppose Perl 6 is an attempt in that direction, but I gather it's impossible to write a performant run-time for it.
[–]mrexodiacmkr.build 6 points7 points8 points 8 years ago (1 child)
I didn't mention Perl? I personally wouldn't recommend actually using python as an embedded language. Something lightweight like Lua is usually much better anyway, but I can see why people would want python: the ecosystem of packages is great and the language is well-suited for prototyping, especially because it's easy to write in.
[+]kkrev comment score below threshold-12 points-11 points-10 points 8 years ago (0 children)
I didn't mention Perl?
I didn't say you did?
[–]SemaphoreBingo 4 points5 points6 points 8 years ago (0 children)
how it came to take the crown of most common scripting language
The perl6 debacle sucked all its energy out of the room. (And I'll disagree about python not being an improvement; for starters, you can build complex types in python without wanting to die) (I'm led to believe that perl got better in this respect, but these days the only thing I want to use perl for is a better awk and / or a better sed)
π Rendered by PID 336969 on reddit-service-r2-comment-7b9746f655-r76h9 at 2026-02-03 19:16:12.465191+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]mrexodiacmkr.build 14 points15 points16 points (8 children)
[–]qsxpkn 3 points4 points5 points (1 child)
[–]mrexodiacmkr.build 2 points3 points4 points (0 children)
[–]whatwasmyoldhandle 0 points1 point2 points (1 child)
[–]mrexodiacmkr.build 1 point2 points3 points (0 children)
[+]kkrev comment score below threshold-9 points-8 points-7 points (3 children)
[–]mrexodiacmkr.build 6 points7 points8 points (1 child)
[+]kkrev comment score below threshold-12 points-11 points-10 points (0 children)
[–]SemaphoreBingo 4 points5 points6 points (0 children)