Sign in to follow this  
arithma

C++ and Python

Recommended Posts

arithma    226
For what reasons a C++ programmer would need to learn Python. I mean is it just syntactical differences, or are there other possible benefits.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Unlike C# and Java, both of which are attempts to make some kind of "easier C++" for increased programmer productivity, Python actually succeeds at making a language that's easier to write in. And it does it without treating the programmers as idiots too. All it requires is a few days of getting used to.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Quote:
For what reasons a C++ programmer would need to learn Python. I mean is it just syntactical differences, or are there other possible benefits.


It's a completely different language.

Reasons for using python:

- You want dynamic typing.

- You want automatic memory management.

- You want built-in bignums in your language.

- You want to pass around functions like first-class objects.

- You want a (limited) lambda construct.

- You want a simple way to write generators and coroutines.

- You like list comprehensions.

- You like the convenience of an interactive interpreter.

- You want to use introspection in your code.

- You like writing less rather than more code to get the job done.

- ...

Share this post


Link to post
Share on other sites
arithma    226
Quote:
Original post by Anonymous Poster
Quote:
For what reasons a C++ programmer would need to learn Python. I mean is it just syntactical differences, or are there other possible benefits.


It's a completely different language.

Reasons for using python:

- You want dynamic typing.

- You want automatic memory management.

- You want built-in bignums in your language.

- You want to pass around functions like first-class objects.

- You want a (limited) lambda construct.

- You want a simple way to write generators and coroutines.

- You like list comprehensions.

- You like the convenience of an interactive interpreter.

- You want to use introspection in your code.

- You like writing less rather than more code to get the job done.

- ...


SOLD!

Share this post


Link to post
Share on other sites
Ezbez    1164
Also, if you're looking for a scripting language for your project, Python could fit the bill. Naturally, actually knowing the language helps when you want to embed it into your program. For the actual embedding, check out Boost.Python.

Share this post


Link to post
Share on other sites
Zahlman    1682
Just FWIW, there do exist real-world projects where Python is used to (a) "pre-cook" user-friendly data into a compact binary file to save space in the deployed version of the program (especially for mobile games); (b) generate C++ code (for example, forward-declaration headers a la <iosfwd>). I can say that with confidence because I have created both such things myself ;)

Share this post


Link to post
Share on other sites
MrRage    127
This might have been mentioned before, but you can prototype an application in Python in far less time than it would take to make the same application in C++. Sure it won’t be as fast, but speed isn’t everything.

When you prototype something in Python just ask your self, is it fast enough to do the job? If the answer is yes then great, you saved your self a lot of time and have a working product.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this