Open
Description
This issue is intended to track the status of Python 3.8 core features as implemented by MicroPython.
Python 3.8.0 (final) was released on the 14 October 2019. The Features for 3.8 are defined in PEP 569 and a detailed description of the changes can be found in What's New in Python 3.8.
- PEP 570, Positional-only arguments
- PEP 572, Assignment Expressions; Done, see #4908
- PEP 574, Pickle protocol 5 with out-of-band data
- PEP 578, Runtime audit hooks
- PEP 587, Python Initialization Configuration
- PEP 590, Vectorcall: a fast calling protocol for CPython
Misc
- f-strings support = for self-documenting expressions and debugging; Done, see #7649
- A
continue
statement was illegal in thefinally
clause due to a problem with the implementation. In Python 3.8 this restriction was lifted; Done, see 82c494a - The
bool
,int
, andfractions.Fraction
types now have anas_integer_ratio()
method like that found infloat
anddecimal.Decimal
- Constructors of
int
,float
andcomplex
will now use the__index__()
special method, if available and the corresponding method__int__()
,__float__()
or__complex__()
is not available - Added support of
\N{name}
escapes in regular expressions - Dict and dictviews are now iterable in reversed insertion order using
reversed()
- The syntax allowed for keyword names in function calls was further restricted. In particular, f((keyword)=arg) is no longer allowed
- Generalized iterable unpacking in yield and return statements no longer requires enclosing parentheses
- When a comma is missed in code such as [(10, 20) (30, 40)], the compiler displays a SyntaxWarning with a helpful suggestion
- Arithmetic operations between subclasses of
datetime.date
ordatetime.datetime
anddatetime.timedelta
objects now return an instance of the subclass, rather than the base class - When the Python interpreter is interrupted by
Ctrl-C (SIGINT)
and the resultingKeyboardInterrupt
exception is not caught, the Python process now exits via aSIGINT
signal or with the correct exit code such that the calling process can detect that it died due to aCtrl-C
- Some advanced styles of programming require updating the
types.CodeType
object for an existing function - For integers, the three-argument form of the pow() function now permits the exponent to be negative in the case where the base is relatively prime to the modulus
- Dict comprehensions have been synced-up with dict literals so that the key is computed first and the value second
- The
object.__reduce__()
method can now return a tuple from two to six elements long
Changes to MicroPython built-in modules
- asyncio
-
asyncio.run()
has graduated from the provisional to stable API - Running
python -m asyncio
launches a natively async REPL - The exception
asyncio.CancelledError
now inherits fromBaseException
rather thanException
and no longer inherits fromconcurrent.futures.CancelledError
- Added
asyncio.Task.get_coro()
for getting the wrapped coroutine within anasyncio.Task
- Asyncio tasks can now be named, either by passing the name keyword argument to
asyncio.create_task()
or thecreate_task()
event loop method, or by calling theset_name()
method on the task object - Added support for Happy Eyeballs to
asyncio.loop.create_connection()
. To specify the behavior, two new parameters have been added:happy_eyeballs_delay
andinterleave
.
-
- gc -
get_objects()
can now receive an optional generation parameter indicating a generation to get objects from- (Note, though, that while
gc
is a built-in,get_objects()
is not implemented for MicroPython)
- (Note, though, that while
- math
- Added new function
math.dist()
for computing Euclidean distance between two points - Expanded the
math.hypot()
function to handle multiple dimensions - Added new function,
math.prod()
, as analogous function tosum()
that returns the product of a ‘start’ value (default: 1) times an iterable of numbers - Added two new combinatoric functions
math.perm()
andmath.comb()
- Added a new function
math.isqrt()
for computing accurate integer square roots without conversion to floating point - The function
math.factorial()
no longer accepts arguments that are not int-like
- Added new function
- sys - Add new
sys.unraisablehook()
function which can be overridden to control how “unraisable exceptions” are handled
(Changes to non-built-in modules will need to be documented elsewhere.)
Metadata
Metadata
Assignees
Labels
No labels