Student Login

The Magic Word For Python 3

Seems foolish. I wrote a whole book on advanced Python programming, focused on Python 3. In some circles, a large majority are still using Python 2, and don't intend to change soon. Why would I alienate them all?

Here's the truth: if you continue to develop in Python, you'll have to start coding in 3 soon. You won't have a choice. The main Linux distributions now all ship with only Python 3. Major projects like Django, Jupyter, Pandas, and more intend to end their Python 2.x support. And the Python core dev team is about to stop providing even critical security updates for 2.7.

Yep. Python 2.7 will soon be like Windows XP.

This is coming faster than you think. I've been teaching large, advanced Python trainings online for the past year: hundreds of engineers per month, from companies around the world, each using Python in their day to day work. A year ago, less than 20% said they use Python 3. Now, it's consistently over half. Python is crashing through the inflection point as we speak.

Listen: There will come a day when having only Python 2 on your resume will make it look dated. Do you want to scramble and cram to learn the new version the night before your dream job interview? Or is it better to start now.

You know the answer. If you plan to abandon Python forever next year, don't bother. But most of us benefit from building on what we know, and Python will stay in demand for a long time.

Once you've decided, you might have a problem: your teammates. Wonderful as they are, they're human. And thus, creatures of habit. It's not enough for you to want to start your next project in Python 3. Most of us work on teams with other developers. And if everyone wants to use the older version, how do you convince them?

Fans of Python 3 have been frustrated at the speed of the transition. But in fact, lingering at 2.7 has been very good for Python. It's been an island of stability: an excellent version of the language that has been useful for years. These days, we all have too much to learn; we're all overwhelmed with a backlog of things we tell ourselves we should be learning. That Python wasn't changing for a while has been a gift.

That's now coming to a close. As the one on your team aware of that, it's your job to help others realize it - so they have time to peacefully adapt to the new reality.

I'll teach you one word you can use, that will help. It's magic. That word is: legacy. From now on, you will refer to Python 2.7 as "Legacy Python".

Using this word is FUN. You'll have conversations like:

You: For this next project, do you want to use Legacy Python, or the current release?
Tech lead: Uh... well, we've been using 2.7, so... let's just use that.
You: Okay, great. I'll get started then.
Tech lead: Er... thanks. (Silently ponders the implications of starting a new project on a legacy platform)

When you get good at this, it'll be all you can do not to crack up, as you watch people's minds working. That's part of the fun. Whatever you do, just keep a straight face.

Be subtle; don't throw it in people's face. Use regular tonality as you say it, not emphasizing the word in any way ("Do you want to use LEGACY!!! Python?"). Speak like it's the most natural thing in the world to say.

Your goal is to get people thinking about it on their own. Let it bake. Slowly, gradually. Use the magic word in conversation with people once or twice a week - that's enough. Do this right, and it won't be long before you hear others on your team start to use it.

The delightful sneakiness of this word is that no one can really argue with it, even as you casually insert it in your day-to-day language. Let's count the major releases since 2.7: 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6... that's seven major releases of Python since Legacy Python was released. Django, Pandas and more are all about to stop supporting it. And it mostly doesn't ship with Linux anymore.

If someone does push back, play coy. Be respectful, yet mildy surprised they aren't aware. Don't win any arguments. Just get them thinking about Legacy Python. With the right nudge, it won't be long before they convince themselves.

For Teams Bootcamp