-
-
Notifications
You must be signed in to change notification settings - Fork 276
Python 3 planning
Paul McGuire edited this page May 28, 2019
·
9 revisions
Which Python 3 version will be targeted? For instance, if f-strings are used, then this will preclude use by Py3 prior to 3.6.
Desired Python 3 features:
- use of nonlocal (3.0)
- except exceptiontype as var: (3.0)
- OrderedDict (3.1)
- autonumbered
str.format
{}
placeholders (3.1) -
str.format_map
(3.2) -
callable()
builtin (3.2) -
yield from
(3.3) -
raise Exception from None
to abbreviate exception tracebacks (3.3) - function
__qualname__
(3.3) - types.SimpleNamespace (3.3)
-
ipaddress
module (3.3) -
enum
module (3.4) -
pathlib
module (3.4) - infix
@
operator (3.5) -
typing
module (3.5) -
collections.abc.Generator
(3.5) - f-strings (3.6)
- '_' in numeric literals and formats (3.6)
-
__init_subclass__
(3.6) - enum
auto()
numbering (3.6) - functools.singledispatch (method signature overrides) (3.6)
- dataclasses (3.7)
- postponed annotation eval (future) (3.7)
- Forced UTF-8 runtime mode (3.7)
- breakpoint() builtin (3.7)
- module
__getattr__
- contextlib.nullcontext() (3.7)
Conversion of examples?
- can be done any time, backward compatibility of examples is not a requirement
- if examples use a later Python feature, should use future import or do upfront Py version validation
Py2 compatibility code to be deleted:
- iterkeys, itervalues, iteritems in ParseResults
- _ustr()
- _MAX_INT
- import compatibility try-excepts
- unicode string literals (
u"lskdjjf"
) __nonzero__
-
super(type, self)
-> just plainsuper()