Why I Decided to Switch Gears, Get a New Book, and Learn Python 3 and 2 Simultaniously

akira
2 min readNov 14, 2019

--

A few days ago, I picked up my first Python book, O’Reilly’s “Learning Python”, 5th edition. It was amazing, funny, and clearly written.

But, when I would open my terminal to run the exercises…well, that was another story. That was not amazing, or funny. I have Python 2.7 on my machine for work, and yes, virtual machines are a thing, but I know myself, and once I emerge from the rabbit hole of a new technology, I’ve lost an hour and I’m no closer to doing these exercises.

And when I went to work on my internship projects with a legacy codebase, I was frustrated by the differences and saw that the time I spent in the book wasn’t applicable to what I was working on. So essentially, an exercise in wasting time. I don’t have a lot of time; I have a job and a life and a very dirty house and a lot of code to write, so learning non-applicable information in my new field is very low on my priority list.

I would pull data structure problems from Hackerrank to do and stay frustrated for *way* too long with my inability to run a simple <print> function with Python 2.x.

Since the code base I’m working on now is in Python 2.x, and since legacy code is (surprise) a thing in software jobs, I decided to revert to an earlier edition of the O’Reilly “Learning Python” book. I’m stuck in a weird predicament; knowing absolutely no Python makes Python three look incredibly weird (why can’t I just..freakin…print??) while working with legacy code at my current position forces me to write Python 2.x. But, Python 3 *is coming*, and its coming fast. So I will have to learn it soon and become comfortable with it *while also being comfortable with older versions of Python*.

Luckily, after some research, I found the 4th edition of this book to be for people in my exact position; people new to Python stuck between the two worlds.

And as for learning both; and…my idea is to solve the same challenges on HackerRanks/CodeWars/Exercism in both 3.0 and 2.7 (and maybe an even older 2.x, cause I’m nuts) and take notes along the way; what the differences are, and why they are different from one version to another; what problems did the upgraded language solve and which ones did it create?

Till then, if you are learning Python for the first time, do yourself a favor and go with the older edition of this book. I know Python 3 is the future, but we haven’t left the past entirely behind yet.

--

--