I bought a bunch a cheap books on Python and am wondering whether I should read them as Python 3 introduced changes to the language and so to speak broke old code as far as I can tell.

I am reading Programing in Python 3, and after that I was going to go through the older books covering older builds of Python and wanted to know whether it is advisable to read them as I don't want to pick up bad programming habits.

Or if you can recommend others.

Thanks

Recommended Answers

All 5 Replies

If you change the print statement to a print() function you can do about 95% of the older sample code with Python3. Actually the print() function was there for Python25. Also, with Python3 the old raw_input() for strings is now input() for strings. So, go ahead and use the older books and those code examples. Python3 books are not very plentiful as of yet.

One of the best tutorials on Python3 is a free online book from Swaroop C.H. who has rewritten his excellent beginning Python tutorial for Python3:
http://www.swaroopch.com/notes/Python_en:Table_of_Contents

If you change the print statement to a print() function you can do about 95% of the older sample code with Python3. Actually the print() function was there for Python25. Also, with Python3 the old raw_input() for strings is now input() for strings. So, go ahead and use the older books and those code examples. Python3 books are not very plentiful as of yet.

One of the best tutorials on Python3 is a free online book from Swaroop C.H. who has rewritten his excellent beginning Python tutorial for Python3:
http://www.swaroopch.com/notes/Python_en:Table_of_Contents

Thanks a lot, I did find the website on my search for python 3 notes although I never really took the time to look into it, going to start it now.

The best way I think is to get a solid foundation in Python 2. That and read up a bit on unicode. Once done, you can just read the "What's new in python 3" page (Google it) and learn everything there is to know about using python 3.

commented: Absolutely, +1 +4

The best way I think is to get a solid foundation in Python 2. That and read up a bit on unicode. Once done, you can just read the "What's new in python 3" page (Google it) and learn everything there is to know about using python 3.

I second that, and also suggest learning good style at the same time that you learn the language. I like PEP 8, but I think a good style is essential to good programs.

I agree about good style, I'm going to start cracking the books. Thanks a lot for the advise and links.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.