Python and C++

Started by
31 comments, last by wodinoneeye 17 years, 1 month ago
Ive been deciding between learning Python or C++ as a first ever language and first time programming. From what I am reading, Python is easier to learn but doesnt have the same abilities as C++. On the other hand C++ is alot harder to learn but is more extensive. Which do you think would really be best for a beginner hoping to eventually program games? I read somewhere that some consider Python to be minimalist because the program does away with many problems associated with other languages. I just dont want to take shortcuts in my learning, It seems like learning C++ introduces you to almost every aspect of programming while Python kind of sugar coats some things. This is just how it seems to me based on my reading, I might be totally wrong. So please suggest which language would benefit me more. I also need to know what I need to be able to write code and turn it into a program? Can these languages be dealt with totally in Windows or do I need a Unix system?
Advertisement
You can do Python or C on either Win/Linux systems.

There are concepts in C which make it difficult for people learning to code. Pointers, references & C sytle arrays[] seem to take people a long time to fully understand, and then you also have to understand the class concept. Python uses classes similar to C and you can actually port data between Python & C with some of the python headers and libs for C. Ron Penton did some neat stuff integrating Python w/ C in his book Mud Game Programming. He wrote a bunch of wrappers which are free to DL which would make integrating them much easier.

You want to make games, I would say start with C since you can add Python as a scripting to it later.
Quote:Original post by biggjoee5790
On the other hand C++ is alot harder to learn but is more extensive.
It depends on what you mean by "extensive". There's a lot more of the basic language to learn than there is with Python. At the same time, though, Python offers all the functionality of C++ and more.
Quote:Which do you think would really be best for a beginner hoping to eventually program games?
Python. Hands down.
Quote:It seems like learning C++ introduces you to almost every aspect of programming while Python kind of sugar coats some things.
Learning C++ introduces you to almost every aspect of C++. (There are major aspects of programming in general which it omits.) It has the advantage of being more widely used in the industry than Python. As a first language, however, it's a very poor choice; and in my experience, people who try to learn C++ as their first language frequently either burn out or end up less proficient as programmers than those who start with a more user-friendly language and then learn C++ later on.
I absolutely, definatly suggest Python. There are many things to learn when starting to program that are more important than knowing how to work with "C++ specific problems". Algorithms, good program design etc, and Python is going to let you focus on learning that stuff much better than C++. C++ is probably one of the worst possible languages to start learning, and while you probably will end up learning it in the end its not a good place to start.

Think of it like this: Python is that awsome pedagogic teacher you remember from your early school years that made learning fun, and C++ is the army drill-sergeant making you crawl through mud with a backpack full of rocks, while he's bellowing orders and firing machine-gun bullets around your ass.

so its, "learn while having fun" vs "learn or get you ass shot full of hot lead"
Quote:
From what I am reading, Python is easier to learn but doesnt have the same abilities as C++.


Define "abilities". If we're talking about the speed of number-crunching programs, C++ is superior. If we talk about which language is more effective and elegant in expressing algorithms and patterns, Python is of course superior(since it is a much higher level language).

Quote:
I read somewhere that some consider Python to be minimalist because the program does away with many problems associated with other languages. I just dont want to take shortcuts in my learning, It seems like learning C++ introduces you to almost every aspect of programming while Python kind of sugar coats some things.


C++ is also take "shortcuts" in comparison to,say, assembly. The whole notion of programming languages is to take shortcuts, otherwise we would still write our programs in hex editors. If you think chasing memory leaks and segmentation faults is an "aspect of programming" you want to get in touch with from the beginning of your learning, then I suppose you'll like C++. Otherwise, you would be wise of choosing another higher-level language like C#,Python or Ruby.
Quote:Original post by biggjoee5790
From what I am reading, Python is easier to learn but doesnt have the same abilities as C++.

That's correct. It has more.

C++ doesn't natively support introspection, or reflection, or metaclass hacking. C++ doesn't support tuples as a language intrinsic (even with the modern Standard C++ Library). C++ doesn't natively possess the ability to compile itself, or spawn instances of its compiler/interpreter. Among others. (And let's not even get into expressivity.)

Quote:On the other hand C++ is alot harder to learn but is more extensive.

No. It's just faster at run time, in specific cases.

Quote:Which do you think would really be best for a beginner hoping to eventually program games?

Python, because you'll focus on making the game, rather than on getting the source to compile, or link, or locate resources, or add a new library, or the thousands of other environmental failures common in beginner usage of C++.

Quote:I read somewhere that some consider Python to be minimalist because the program does away with many problems associated with other languages.

That's an interesting definition of "minimalist." Bookmark that source, and make sure you never visit it again.

Quote:I just dont want to take shortcuts in my learning, It seems like learning C++ introduces you to almost every aspect of programming while Python kind of sugar coats some things.

In short, no.

In greater length, programming effectively in C++ requires a greater understanding of the underlying platform and its mechanisms. This knowledge is useful, eventually, but not in all cases (in fact, arguably not in the majority of cases). A language like Python lets you take advantage of such knowledge as you come to possess it; a language like C++ will often stall you until you possess it - which, by definition, you don't as a beginner.

Quote:I also need to know what I need to be able to write code and turn it into a program?

Generally, C++ must be compiled into a native binary for your specific platform while Python is interpreted. One advantage of the interpreter is that the same Python code will often run, unaltered, on multiple platforms. The same C++ code may compile and may link, but once you stray from the Standard Library, it almost certainly will not run.

If you're a Windows user, I recommend Microsoft Visual C++ 2005 Express Edition for C++ and ActiveState ActivePython for Python. Both are free. The latter (ActivePython) is a much smaller download with much lower system requirements.


Here's the thing a lot of people advocating C++ as first language forget: you will need more than one language, eventually. As much as I love Python, and it's my default language to do anything in, at work we use C++ and Perl on both Windows and Linux exclusively. I have PHP, Ruby and Tcl interpreters on this machine, too, in case I need to do something quick and dirty. And I don't count markup and "web technologies" (though I should install SpiderMonkey and play around with JavaScript...)

Learning Python first lets you focus on learning programming, after which it becomes easier to learn other languages - they become an exercise in mapping concepts you are already familiar with onto new syntax.

Happy hacking! [smile]
Wow you guys really cleared alot up for me. Im sure that Im going to start with Python now, I dont want to find myself too frustrated and decide to quit getting caught up in C++ problems. It seems like once you know a language well, learning others becomes easier. Im going to try to get everything I need to begin learning Python, hopefully I can get some good books. Now I do want to know, can you use Python to program games well? both 2d and 3d? I know that at first I wont be making any games. Im guessing Id start with simple text based apps and then move up from there
Have a look at PyGame
I wanted to ask something else about Python. I wanted to know if its an "all purpose language". What I mean by that is, can it be used for making all sorts of programs efficiently. I know that certain languages are suited for certain tasks. Ive read that C++ can be used for programming almost anything which is why its used so extensively. Im asking this because, even though I said I want to program games, I want to have the ability to create all types of programs not just games. I just want to learn a first language that will allow me to be a versatile programmer and learn all the most important aspects of programming. In other words I want to start with the most general ideas and skills and then begin to specialize. I hope that makes sense :)
Python is most certainly NOT a domain-specific language. In terms of applicability to diverse areas of development, Python and C++ are just about equal.

This topic is closed to new replies.

Advertisement