Python 2 vs. Python 3: Which LPTHW book should I get?


#1

New visitors to Learn Python the Hard Way may be confused about whether they should read the Python 2 version or the Python 3 version of your book. What guidance can you provide to users with differing programming abilities?


#2

I break it down like this:

If you just want to learn to code then it doesn’t matter. Pick whichever one is easiest to install.

  • If you have a Mac then you already have Python 2 installed, so the Python 2 book is fine.
  • If you’re on Windows then go with the Python 3 book as it’s done entirely on a Windows 10 computer so it’ll work great. The Python 3 book supports all three (Windows, MacOS, and Linux), but I made extra sure it worked on Windows.

If you want to get into Data Science, then Python 3 is used there, so get the Python 3 book.

Thanks for the question.


#3

I highly recommed that you learn Python 3. Python 2 support will be discontinued in 2020. countdown


#4

They’ve said they’ll discontinue support many times and it never happens. Learn the python that you have.


#5

I purchased Python 2 long time ago… and very recently just got LMP3THW but the part that I am interested the most is DB which is not ready yet.

I wonder if after those purchase we could get some sort of super great loyalty discount and maybe I can get P3 as part of more practicing? That’ll be nice…


#6

Actually it’ll be very nice if PYTHON 2 course (for those old timers here) can tell DEPRACATED in the content.

An example of this would be the ‘formmater’ part of printing in P2 since is now depracated in P3. That’ll be at least helpful for old of us with access to old content here.


#7

Rather than doing that I just wrote a Python 3 book. Despite what Python people say, there is still plenty of need for Python 2.


#8

I think it’s better to Learn python 3. OK, sure if you have Python 2 only learn it. But Python 3 has continued to develop as a language, with more features being added that improve the language. I think the weight of the python community has now tilted towards Python 3. Most of the interesting talks online are written around Python 3. I recommend Python 3. I don’t see why I’d use 2 any more. Well, OK, there’s stuff that only available in Python 2 because those things aren’t used that much, and are too hard to port. If you need to use Python 2, then do. But, if your 50/50, I’d go with Python 3 like most of the community.


#9

I checked out both books, and I honestly… like the formatting of python 3 a lot better.

Plus a lot of my friends who are in the tech industry gear towards python 3, and it makes it a lot easier to read a lot of code that is on github.

just my two cents.


#10

Nice,… I’ve been away for a long time and I think is a great idea that @zedshaw come up with this forum idea which is an incentive to ‘keep on learning’ since I don’t feel we are no longer alone.

Anyway… I know that the importance of P2 is ‘backward compatibility’ but looking forward (since I’m not professionaly active on python at all) I’m getting all around P3.

Just sharing my thoughts on this…


#11

I haven’t tried python three formating, but not overly fussed, yes you can achieve things in two line that might take you three, however readability is reduced, certain amount of verbose is needed. It’s like going to a fine restaurant and ending up in a pool hall. I’m really only new so don’t take my word for being “the best option”.

But if you like music or poetry, than python 2 is like these python 3 is the daily news, boring even though it is dramatic.


#12

I put a lot of work into the updating the Python 3 book so that it’s matching more what’s going on in Python these days, but without some of the dumber stuff I see them doing.


#13

A huge reason why I purchased your book!

My friends have critiques (of course), but I find your style particularly captivating, and it allowed me to actually write an openfile.py program that impressed my friends.

They were like… F STRINGS!!! YOU GOT F STRINGS EVERYWHERE MAN :slight_smile:


#14

@ricarod What is DB? I am hours old in the coding world :stuck_out_tongue:


#15

Data base.

I was referring to the part of coding that is not about making a program that makes calculation (like a function that return the area of a rectangle) but the ones that store records persistently like clients information, billing, etc.

You can then take that, put it on a web framework and have something to offer as a service


#16

Eh I was wrong. Coding style doesn’t change much.


#17

https://docs.python.org/3.0/whatsnew/3.0.html#text-vs-data-instead-of-unicode-vs-8-bit


#19

I find that so bizarre. So, the Python 3 proponents will tell you to use Python 3 because it’s the future, but if you use the most recent version of Python and use the best feature of it (f-strings rock), then ohhhh nooooo that’s tooo much future good sir! We mean Python 3.5, but definitely because it’s the future, just not so much future as 3.6, because that’s so much future.


#20

Dare I ask … Wtf are F Strings?


#21

The Python 3 version of formatting strings. In Python 2 it was

print("{} bar".format("foo"))

Output: foo bar

In Python 3 you do

var = foo
print(f"{var} bar")

Output: foo bar