Python for C ++ Developers

Iโ€™ve been a C ++ / Java developer for a long time trying to get into Python, and Iโ€™m looking for the stereotypical article "Python for C ++ Developers", but itโ€™s empty. I have seen such things for C #, Java, etc., and they are incredibly useful for speeding up language functions and noteworthy differences. Does anyone have any links?

As a bonus question, what kind of open source Python program would you suggest looking for clean design, commenting, and using the language as a guideline for learning?

Thanks in advance.

+43
c ++ python
Nov 30 '08 at 7:14
source share
8 answers

I never understood the "Language X for Language Y" approach. When I learn X, I want to learn how to program in it the way Language X programmers do it, and not the way Language Y programmers do it. I want to learn features, idioms, etc. that are unique to a language that I study. I want to be able to use what makes the language special and use this knowledge to expand my ways of thinking and solving problems. I do not think that I would get the same understanding from a textbook that was framed in the context of another language. If you can learn your first language without a textbook that focuses on what you already know, you should be able to choose a second language in the same way (and in my experience, the more languages โ€‹โ€‹you know, the easier it is to learn new ones).

With that said, I would recommend The Python Tutorial as a good, fast, and easy way to access Python and Dive Into Python as a more complete introduction, also available for free here . I also agree that others have said that they consider the code of standard libraries as a source of good examples and design methods, the standard python libraries are pretty clean and easy to read.

+26
Nov 30 '08 at 7:28
source share

Dive Into Python is a Python book for experienced programmers.

+12
Nov 30 '08 at 8:24
source share

Dive Into Python is great, but don't forget PJE Python. It's not Java .

+5
Dec 08 '08 at 16:05
source share

I learned a lot about Python by reading the source of the standard library that comes with Python. I think I remember a few "aha!" moments when reading urllib2.py in particular.

+4
Nov 30 '08 at 7:36
source share

Python is quite different from C ++, so certain knowledge usually cannot be passed on. There are several language comparisons . What you can port is knowledge of specific APIs, for example. POSIX APIs or sockets.

As an example of a typical Python application (GUI), consider IDLE (as sent for Python).

+2
Nov 30 '08 at 7:39
source share

C # and Java are seen as cleaner substitutions for C ++ in many areas of applications, so there is often a "transition" from one to another, so books are available.

Python and C ++ are very different animals, and although both are considered publicly available programming languages, they are aimed at different ends of the programming spectrum.

Do not try to write C ++ in Python; in fact, try to forget C ++ when writing Python. I was much better off learning the general paradigms and methods of Python and applying them to my C ++ programs than vice versa.

+1
Nov 30 '08 at 10:03
source share

To learn the language, a free and online python tutorial is all you need to pick up the language and start writing applications. If you want a book, I found The Beginning of Python from Apress to be a great reference and tutorial. Of course, the best way to learn the language is to write code, so I would recommend that you check Boost.Python . If you have C ++ that needs to be a little more flexible, Boost.Python can give you a good reason to learn Python and pay for it.

+1
Nov 30 '08 at 16:36
source share

For the best examples of language code, the standard language library is often a good place to search. Choose a recent article, although the old parts were probably written for older versions, and were also sometimes written before the library became large enough to justify large standards - for example, the PHP and Erlang libraries, which have internal inconsistencies.

For Python, in particular, Python 3000 cleans up the library a lot, and is probably an excellent source of good Python code (although it is written for a future version of Python).

0
Nov 30 '08 at 7:36
source share



All Articles