# MicroPython differences from CPython

MicroPython implements Python 3.4 and some select features of Python 3.5 and above. The sections below describe the current status of these features.

- Python 3.5
- Python 3.6
- Python 3.7
- Python 3.8
- Python 3.9
- Python 3.10

For the features of Python that are implemented by MicroPython, there are sometimes differences in their behaviour compared to standard Python. The operations listed in the sections below produce conflicting results in MicroPython when compared to standard Python.

- Syntax
  - Argument unpacking does not work if the argument being unpacked is the nth or greater argument where n is the number of bits in an MP_SMALL_INT.
  - MicroPython allows using := to assign to the variable of a comprehension, CPython raises a SyntaxError.
  - uPy requires spaces between literal numbers and keywords, CPy doesn’t
  - Unicode name escapes are not implemented
- Core language
  - f-strings don’t support concatenation with adjacent literals if the adjacent literals contain braces or are f-strings
  - f-strings cannot support expressions that require parsing to resolve unbalanced nested braces and brackets
  - Raw f-strings are not supported
  - f-strings don’t support the !r, !s, and !a conversions
  - Special method __del__ not implemented for user-defined classes
  - Method Resolution Order (MRO) is not compliant with CPython
  - When inheriting from multiple classes super() only calls one class
  - Calling super() getter property in subclass will return a property object, not the value
  - Error messages for methods may display unexpected argument counts
  - Function objects do not have the `__module__` attribute
  - User-defined attributes for functions are not supported
  - Context manager __exit__() not called in a generator which does not run to completion
  - Local variables aren’t included in locals() result
  - Code running in eval() function doesn’t have access to local variables
  - __all__ is unsupported in __init__.py in MicroPython.
  - __path__ attribute of a package has a different type (single string instead of list of strings) in MicroPython
  - Failed to load modules are still registered as loaded
  - MicroPython does’t support namespace packages split across filesystem.
- Builtin types
  - Exception
  - bytearray
  - bytes
  - dict
  - float
  - int
  - list
  - str
  - tuple
- Modules
  - array
  - builtins
  - deque
  - json
  - os
  - random
  - struct
  - sys

Language and External Links

Language
  English
  中文

External links
  openmv.io
  forums.openmv.io
  github.com/openmv/openmv
  micropython.org
  forum.micropython.org
  github.com/micropython/micropython