[ACCEPTED]-Python for C++ Developers-python
I never really understood the "Language 27 X for Language Y developers" approach. When 26 I go looking to learn Language X I want 25 to learn how to program in it the way that 24 Language X programmers do, not the way Language 23 Y programmers do. I want to learn the features, idioms, etc. that 22 are unique to the language that I am learning. I 21 want to be able to take advantage of the 20 things that make the language special and 19 use that knowledge to expand my ways of 18 thinking and solving problems. I don't 17 think I would get the same sort of insights 16 from a tutorial that was framed in the context 15 of another language. If you can learn your 14 first language without a tutorial geared 13 towards something you already know you should 12 be able to pick up a second language the 11 same way (and in my experience, the more 10 languages you know the easier it is to learn 9 new ones).
With that said, I would recommend 8 The Python Tutorial as a good, quick, and easy way to get going 7 with Python and Dive Into Python as a more complete introduction, also 6 available for free here. I would also agree 5 with what others have said regarding looking 4 at the code for the standard libraries as 3 a source of good examples and design practices, the 2 standard python libraries are pretty clean 1 and easy to read.
I learned a lot about Python by reading 3 the source of the standard library that 2 ships with Python. I seem to remember having 1 a few "a-ha!" moments when reading urllib2.py
in particular.
To learn the language the free and online 10 python tutorial is really all that you need to pick up 9 the language and start writing apps. If 8 you want a book, I've found Beginning Python from Apress 7 to be an excellent reference and tutorial. Of 6 course the best way to learn a language 5 is to write code, thus I would recommend 4 that you check out Boost.Python. If you have a C++ that 3 needs to be a bit more flexible, Boost.Python 2 can give you a good excuse to learn Python 1 and get paid for it.
Python is sufficiently different from C++ so 6 that specific knowledge can't normally be 5 transferred. There are a few language comparisons available. What 4 you can carry over is knowledge of specific 3 APIs, e.g. of the POSIX or socket APIs.
As 2 an example for a typical Python (GUI) application, look 1 at IDLE (as shipped for Python).
C# and Java are seen as cleaner replacements 13 for C++ in many application areas so there 12 is often a "migration" from one to the other 11 - which is why there are books available.
Python 10 and C++ are very different beasts, and although 9 they are both considered general purpose 8 programming languages they are targetted 7 towards different ends of the programming 6 spectrum.
Don't try to write C++ in Python; in 5 fact, try to forget C++ when writing Python. I 4 found it far better to learn the common 3 Python paradigms and techniques and apply 2 them to my C++ programs than the other way 1 around.
For the best examples of code of a language, the 11 language's standard library is often a good 10 place to look. Pick a recent piece, though 9 - old parts are probably written for older 8 versions and also sometimes were written 7 before the library became big enough to 6 warrant big standards - like PHP and Erlang's 5 libraries, which have internal inconsistency.
For 4 Python in particular, Python 3000 is cleaning 3 up the library a lot, and so is probably 2 a great source of good Python code (though 1 it is written for a future Python version).
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.