r/learnpython • u/woods48465 • Dec 18 '16
python 2 to 3
Hi, I'm about 15 lessons in to learn python the hard way and I just found out that it is outdated. My question is should I just abandon it and move to something else on the python 3 platform like automate the boring stuff with python or should I still go through with it?
10
Upvotes
3
u/anglicizing Dec 18 '16 edited Dec 18 '16
I'm not familiar with LPTHW, but as a general advice when it comes to the differences between python 2 and python 3... they're not that significant when it comes to learning the language.
In brief, there's some stuff happening with how python interprets string literals by default and what the
strtype is an alias for (in python 2 it'sbytes, in python 3 it'sunicode). Also the print statement has become a (superior) print function in python 3, so it needs parenthesis, and a bunch of built-ins have become iterators instead of returning lists. (Edit: and, as /u/Prooffread3r points out, the/operator starts behaving like people generally expect it to).Learning to write and understand valid python 3 when you know python 2 is a couple of hours of work, or thereabouts. Not a big deal, compared to the amount of hours you'll spend learning the language.
So my advice is that you should first and foremost consider whether you enjoy LPTHW or not. If you do, stick with it. If you do, but want to try something else, go for it. If you don't enjoy it, try something else. If you're really unsure what to do, try something else.
6
u/[deleted] Dec 18 '16
Yes, abandon LPTHW. Even if it covered Python3, I never thought it was a good reference or method for teaching. But that is my opinion and being that people keep mentioning LPTHW, there must be some appeal to many people.
My issues with LPTHW, is that it has errors and inconsistencies, and does not teach the beginner proper things like basic data structures and simple techniques and building to more complex ones. I'm not a fan at all of
input()orraw_input()as a means of doing things. Nobody (outside of small children) does that in the real world, and it is slow and painful way to introduce people to programming.It's not until exercise 38 and 39 that lists and dictionaries are introduced. Functions not util 19.
Unfortunately, I've been programming too long and I don't have any basis for recommending a beginner level book. However, I have looked at LPTHW and I don't recommend that one.
2
u/[deleted] Dec 18 '16
If you don't have any special reason to stick with LPTHW I'd rather switch to a more modern tutorial, like ATBSWP as I don't think it makes any sense to work with outdated tutorial when can can use a more up-to-date one.
2
u/thatguy_314 def __init__(ely) Dec 19 '16
I would recommend learning Python 3. Take a look at the learning resources in the wiki here and choose something you like.
1
u/tunisia3507 Dec 19 '16
You're welcome to stick with LPTHW, but I highly, highly recommend looking up the differences between 2 and 3 and then using 3 when you're actually doing exercises and hacking. Otherwise you start with a 2 codebase, then you copy and paste some stuff into new projects, spend a while debugging gotchas and so on - there's just never a better time to switch than right at the start.
However, knowing the differences is valuable in its own right, so translating LPTHW as you go will be a worthwhile exercise!
1
u/[deleted] Dec 18 '16
You can continue. For a beginner, the only real differences are that you need to put parentheses after
printand 3/2 gives 1.5 , not 1.