Preparing to port my company's entire codebase to Python 3.

We've put this off to the last possible minute, now we gotta do it all at once. It's like the Y2K bug but for Python programmers only.

any advice from experienced #Python devs who have crossed this bridge?


@nindokag Yes. Go back in time and add:

from __future__ import absolute_import, division, unicode_literals, print_function

to all your modules.

@nindokag I got this added to the lint rules at Facebook. I got much hate for it but I bet they'd be praising my name today if they actually remembered it was me.

@freakazoid even without a TARDIS that's still useful advice since it tells me those four things are responsible for most of the differences. Thanks!

@nindokag Yeah. Print is trivial to automatically convert, but absolute_import, division, and unicode_literals all change semantics, so are harder to convert without manual intervention.

@freakazoid @nindokag can you make these changes one file at a time or do you have to do your whole codebase at once?

@octesian @nindokag You can convert your codebase to be forward-compatible one file at a time, but you can't use Python 3 itself until you've converted everything.

Sign in to participate in the conversation
R E T R O  S O C I A L

A social network for the 19A0s.