Jump to content
  • Advertisement
Sign in to follow this  
arithma

C++ and Python

This topic is 4141 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
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
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
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!