Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
e9b76107
Commit
e9b76107
authored
May 1, 2016
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
docs/sys: Describe sys.maxsize.
parent
59603a2e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/library/sys.rst
+25
-0
25 additions, 0 deletions
docs/library/sys.rst
with
25 additions
and
0 deletions
docs/library/sys.rst
+
25
−
0
View file @
e9b76107
...
@@ -52,6 +52,31 @@ Constants
...
@@ -52,6 +52,31 @@ Constants
CPython mandates more attributes for this object, but the actual useful
CPython mandates more attributes for this object, but the actual useful
bare minimum is implemented in MicroPython.
bare minimum is implemented in MicroPython.
.. data:: maxsize
Maximum value which a native integer type can hold on the current platform,
or maximum value representable by MicroPython integer type, if it's smaller
than platform max value (that is the case for MicroPython ports without
long int support).
This attribute is useful for detecting "bitness" of a platform (32-bit vs
64-bit, etc.). It's recommended to not compare this attribute to some
value directly, but instead count number of bits in it::
bits = 0
v = sys.maxsize
while v:
bits += 1
v >>= 1
if bits > 32:
# 64-bit (or more) platform
...
else:
# 32-bit (or less) platform
# Note that on 32-bit platform, value of bits may be less than 32
# (e.g. 31) due to peculiarities described above, so use "> 16",
# "> 32", "> 64" style of comparisons.
.. data:: modules
.. data:: modules
Dictionary of loaded modules. On some ports, it may not include builtin
Dictionary of loaded modules. On some ports, it may not include builtin
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment