-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mypyc] Document optimized bytes ops and additional str ops (#18242)
The docs were somewhat out of date.
- Loading branch information
Showing
3 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.. _bytes-ops: | ||
|
||
Native bytes operations | ||
======================== | ||
|
||
These ``bytes`` operations have fast, optimized implementations. Other | ||
bytes operations use generic implementations that are often slower. | ||
|
||
Construction | ||
------------ | ||
|
||
* Bytes literal | ||
* ``bytes(x: list)`` | ||
|
||
Operators | ||
--------- | ||
|
||
* Concatenation (``b1 + b2``) | ||
* Indexing (``b[n]``) | ||
* Slicing (``b[n:m]``, ``b[n:]``, ``b[:m]``) | ||
* Comparisons (``==``, ``!=``) | ||
|
||
.. _bytes-methods: | ||
|
||
Methods | ||
------- | ||
|
||
* ``b.decode()`` | ||
* ``b.decode(encoding: str)`` | ||
* ``b.decode(encoding: str, errors: str)`` | ||
* ``b.join(x: Iterable)`` | ||
|
||
.. note:: | ||
|
||
:ref:`str.encode() <str-methods>` is also optimized. | ||
|
||
Formatting | ||
---------- | ||
|
||
A subset of % formatting operations are optimized (``b"..." % (...)``). | ||
|
||
Functions | ||
--------- | ||
|
||
* ``len(b: bytes)`` | ||
* ``ord(b: bytes)`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters