Ask Your Question
3

c++ or python

asked 2015-05-02 11:40:08 -0500

Mr. CEO gravatar image

I am currently using python to make stuff in ROS, would it be worthwhile to learn cpp? Are there things you can't do with python? Is it easier to program things with c++?

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
3

answered 2015-05-03 19:12:02 -0500

Maya gravatar image

I'll add something to @aak2166 answer.

Some library you might want to use are going to be exclusively in Python or in CPP. For example, as far as I know, PCL is only in C++ so if you want to use it, you will have to learn C++. Smash is only in python.

So it depend as well on your project but knowing both is certainly an advantage since you won't be limited by this.

edit flag offensive delete link more

Comments

There are now PCL bindings for Python.

Adam Allevato gravatar imageAdam Allevato ( 2015-05-04 10:43:43 -0500 )edit

Good thing I said as far as I know :). I didn't know that, thanks for the information.

Maya gravatar imageMaya ( 2015-05-04 10:50:46 -0500 )edit
1

answered 2015-05-04 08:56:15 -0500

scopus gravatar image

Python is used for some modules that don't need fast speed. However, python is easier to be used. I think the combination of Python and CPP could lead to more work efficiency.

edit flag offensive delete link more
1

answered 2015-05-04 07:26:53 -0500

Regarding performance keep in mind that a lot of C++ library (like OpenCV) can be used in Python without loss of performance since they are not executed by Python interpreter. I made some tests with face detection comparing performance between C++ and Python and I did not find significant differences.

My usual approach is to use Python for small integrations and for proof of concept taking advantage of its simplicity and switch to C++ only if this can results in performance improvements.

edit flag offensive delete link more
0

answered 2015-05-02 18:57:54 -0500

aak2166 gravatar image

Python is an easier language to learn and master. The main advantage that a compiled language like c++ has is speed. For example, it might take you two weeks to program something in c++ but only 4 days in python. However, once you create that program in c++ you can expect it to execute faster (depending on the application) by about an order of magnitude.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-05-02 11:40:08 -0500

Seen: 5,255 times

Last updated: May 04 '15