thoughts on C/C++ vs. Python for personal programming
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
thoughts on C/C++ vs. Python for personal programming
I am tring to decide on what to concentrate my efforts on as a programming language. I want to do both command line and wxwidgets stuff for GUI. It seems if I want to do this I must know C++ over C...What are your ideas on learning Python 'instead'?
I just want different thoughts on postivies and negatives of C/C++ vs. Python. I have heard Python is kinda limited for Object oriented stuff, is this true?
I think Python is much easier to get started with, especially for beginning GUI development. Python uses untyped variables, which generally means fewer compilation/execution errors, but it can also lead to problems with maintaining your code; you have to keep in mind what data type all of your variables are, because Python doesn't remind you.
Learning C/C++, on the other hand, would probably give you a better foundation in programming concepts, and better equip you to deal with problems. C++ is more strongly typed than C (meaning the compiler will usually complain if you try to use an int in place of a char), but overall both are pretty weakly typed, which can be both a blessing and curse.
If efficiency is a concern, C/C++ might be a better route, but I would guess for most small- to moderate-sized projects (GUI included), Python would be fast enough.
I'm biased towards OOP, but I know many programmers dislike it (especially C++'s implementation of it). It can be a hindrance to experienced programmers, but I think OOP concepts are easier to learn and apply than strictly functional concepts.
In short, I'd recommend a little of both: learn some of the basics in C/C++ first, to give you a better understanding, then move to Python. Learning Python is a breeze once you know C++, but doing it the other way around might be confusing.
Hi servnov, I was in a similar situation while in college. I was learning all these languages and frameworks and wanted to do some coding on the side for fun. To keep a long story short, almost all of the code I've written in the past month or so has been in Python.
Python is a great language, it has a clean syntax, lots of great libraries and is just fun to program with. For me the main decision in picking Python for my own projects comes down to productivity. I've tried a ton of languages, including C and C++ and while I love both of the later for their own reasons, I found Python to have the shortest "idea to code" transition.
It' simple, I've got an idea, I start up Python and within minutes I've got something going. To me that transition is everything and Python has allowed me to concentrate on the actual coding challenge rather than struggle with the actual language or framework.
Anyway, if you want more info let me know. If you haven't done so, I recommend going through a few tutorials and see if you like Python hands on.
Quote:
I have heard Python is kinda limited for Object oriented stuff, is this true?
Like C++, Python is a multi paradagm programming language. Meaning you can program in many different styles. OOP is just one of the options you have in Python, but if you don't need it (or like it/want it) then you don't have to use it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.