basestring: (str, unicode), essentially ◦ Binary data is str (bytes is an alias in Python 2.6) • Python 3 ◦ Text is str (similar to unicode in Python 2) ◦ Binary data is bytes (sort of similar to str in Python 2) ◦ To see differences, try set(dir(str)). difference(dir(bytes))
with text … ◦ Make it work with Unicode • If it is to work with binary data … ◦ Watch out for indexing on bytes; length-1 bytes object in Python 2, int in Python 3 • Basically be strict with whether you pass in text or binary data, not just str
work with Python 2.6 - 3 as much as possible • Everything at the beginning of this talk, Modernize can update for you • https://pypi.python.org/pypi/modernize
in Python 3 • I'm personally working to fill in remaining gaps ◦ First version of code already done ◦ Just need to move code into Pylint which I already started doing
compare output from Modernize as an alternative • Can use Tox to run tests under various Python versions ◦ Once you can run under Python 3 you will want this ability