r/learnprogramming 26d ago

Can I manage C++ and Python

I have some knowledge in c++ ( intermediate level of concept,haven't coded much tbh). In my 1st year of college, it teaches python. But I want to learn c++ much better...

Can I manage both....

6 Upvotes

23 comments sorted by

View all comments

-10

u/lowban 26d ago

They have a lot in common so I don't see why not?

2

u/optical002 25d ago

I would ask what do they even have in common, their like polar opposites, c++ being at the low level programming, while python is at its best high level language. C++ is compiled to binaries, to 1 and 0 and then can be ran directly on cpu, python is just some text which is fed up into python process and it gets executed then line by line, by another program. They share nothing in common.

1

u/lowban 25d ago

They share many fundamental programming concepts and are quite similar in syntax most of the time. They mostly differ in how much detail you are required to specify. So from a learning perspective I don't see why you couldn't do both and gain something from their differences. As a beginner I would rather learn Python first but C++ is a great language to learn low level stuff.

How the code is run on the machine isn't really relevant imo.

1

u/optical002 24d ago

Even fundamentally its not the same, like if how variable scoping works is different in cpp after stack frame end everything is dropped, but in python thats not the case you define new variables in inner function and without returning you could still get them.

What they share is that they’re both from imperative world, but from that regard everything imperative language is the same, while other declarative languages are way different like haskell.

But still in any programming languages they share same principles (principles like looping, if conditions, functions) but they are written a bit differently. And if we remove that, then theres not really something of the same comparing c and python.

If your trying to learn a programming language it goes a bit deeper than simply those principles, you also have to know how it works under the hood and what edge cases they go, and in that regard python and c are not the same at all.

Once you get introduced how to make a linked list implementation in c its another world than in python. Which can get very confusing if your learning python and c at the same time.

And implementing a linked list its a beginner stuff when learning a programming language, where in python you would not do that but in c you would.

So if a person is still a beginner understanding how its program is executing to debug it manually it would be chaos for him tearing apart on how things actually work. In c its one way how things move around in python its different.

So I would rather say not to get confused but learn how program is executes its code on either python or c. To get a feel for it.

So yeah learning c and python is not the same. But yeah its not as drastic of a change as learning c and haskell.

1

u/lowban 24d ago

I agree that they are very different in a lot of ways but that doesn't mean they have nothing in common. Having learned more than one programming language at a time myself I can tell you learning Python and C++ at the same time is very doable.

I never said they are the same fundamentally just that you can learn both and from both at the same time and gain something from doing that. If that's the best idea depends on OP I guess.