Skip to content

[mypyc] Document librt.strings#21374

Merged
JukkaL merged 8 commits intomasterfrom
librt-strings-doc
Apr 29, 2026
Merged

[mypyc] Document librt.strings#21374
JukkaL merged 8 commits intomasterfrom
librt-strings-doc

Conversation

@JukkaL
Copy link
Copy Markdown
Collaborator

@JukkaL JukkaL commented Apr 29, 2026

This is no longer hidden behind a feature flag, so document it.

Also document that ord("x") is treated as a compile-time constant expression, as it's
related to some typical StringWriter use cases.

Enable links to Python stdlib docs, since they are useful here.

Comment on lines +124 to +125
Read a 16-bit integer value starting at the given index as a little-endian binary value
(2 bytes).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mentioning it's 2 bytes seems redundant since we already mention it's a 16-bit integer. maybe remove it? same in other descriptions.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this to help users with less experience with low-level programming. In order to use the read functions correctly, the caller must increment the index with the correct number of bytes, and this makes the number a bit more explicit. It's kind of redundant, but on the other hand it's only two extra words per function.

@JukkaL JukkaL merged commit 6267911 into master Apr 29, 2026
2 checks passed
@JukkaL JukkaL deleted the librt-strings-doc branch April 29, 2026 16:31
JukkaL added a commit that referenced this pull request Apr 30, 2026
This is no longer hidden behind a feature flag, so document it.

Also document that `ord("x")` is treated as a compile-time constant
expression, as it's
related to some typical StringWriter use cases.

Enable links to Python stdlib docs, since they are useful here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants