Skip to content

Commit 59603a2

Browse files
committed
docs/sys: Describe sys.implementation.
1 parent 4fb9452 commit 59603a2

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

docs/library/sys.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,24 @@ Constants
3434

3535
The byte order of the system ("little" or "big").
3636

37+
.. data:: implementation
38+
39+
Object with information about the current Python implementation. For
40+
MicroPython, it has following attributes:
41+
42+
* `name` - string "micropython"
43+
* `version` - tuple (major, minor, micro), e.g. (1, 7, 0)
44+
45+
This object is the recommended way to distinguish MicroPython from other
46+
Python implementations (note that it still may not exist in the very
47+
minimal ports).
48+
49+
.. admonition:: Difference to CPython
50+
:class: attention
51+
52+
CPython mandates more attributes for this object, but the actual useful
53+
bare minimum is implemented in MicroPython.
54+
3755
.. data:: modules
3856

3957
Dictionary of loaded modules. On some ports, it may not include builtin

0 commit comments

Comments
 (0)