-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Python3
Johnny Robeson edited this page Jul 25, 2016
·
54 revisions
We're in the process of porting the entire beets codebase and its dependencies to Python 3.x.
- all python 2 files must contain
from __future__ import division, absolute_import, print_function
- exceptions must use
except A as B:
instead ofexcept A, B:
-
str.format()
should be used instead of the%
operator - calls to
map()
should be wrapped inlist()
when a list is expected as it returns aniter
in python 3
- remove
u'
(andu"
) prefixes - run 2to3 to make sure we got everything (but be careful of all the
list(map())
wraps, we don't need them all) - audit all calls to open() (or any other I/O) to see if we can read/write them as text vs binary
- remove any PY2/3 version checks and the related code
- remove any usage of six
- add python 3 to trove classification
- replace buffer with memoryview
- replace
codecs.open
withopen
- use explicit keyword arg names in function definitions - PY2:
def foo(.., **kwargs)
-> PY3:def foo(.., arg1=None, arg2=None, ...)
as per https://docs.python.org/3.3/tutorial/controlflow.html#arbitrary-argument-lists