File tree Expand file tree Collapse file tree 3 files changed +55
-2
lines changed Expand file tree Collapse file tree 3 files changed +55
-2
lines changed Original file line number Diff line number Diff line change 1+ .. _bytes-ops :
2+
3+ Native bytes operations
4+ ========================
5+
6+ These ``bytes `` operations have fast, optimized implementations. Other
7+ bytes operations use generic implementations that are often slower.
8+
9+ Construction
10+ ------------
11+
12+ * Bytes literal
13+ * ``bytes(x: list) ``
14+
15+ Operators
16+ ---------
17+
18+ * Concatenation (``b1 + b2 ``)
19+ * Indexing (``b[n] ``)
20+ * Slicing (``b[n:m] ``, ``b[n:] ``, ``b[:m] ``)
21+ * Comparisons (``== ``, ``!= ``)
22+
23+ Methods
24+ -------
25+
26+ * ``b.decode() ``
27+ * ``b.decode(encoding: str) ``
28+ * ``b.decode(encoding: str, errors: str) ``
29+ * ``b.join(x: Iterable) ``
30+
31+ Formatting
32+ ----------
33+
34+ A subset of % formatting operations are optimized (``b"..." % (...) ``).
35+
36+ Functions
37+ ---------
38+
39+ * ``len(b: bytes) ``
40+ * ``ord(b: bytes) ``
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ generate fast code.
3636 bool_operations
3737 float_operations
3838 str_operations
39+ bytes_operations
3940 list_operations
4041 dict_operations
4142 set_operations
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ Operators
2525Methods
2626-------
2727
28+ * ``s.encode() ``
29+ * ``s.encode(encoding: str) ``
30+ * ``s.encode(encoding: str, errors: str) ``
2831* ``s1.endswith(s2: str) ``
2932* ``s.join(x: Iterable) ``
3033* ``s.replace(old: str, new: str) ``
@@ -34,8 +37,17 @@ Methods
3437* ``s.split(sep: str, maxsplit: int) ``
3538* ``s1.startswith(s2: str) ``
3639
40+ Formatting
41+ ----------
42+
43+ A subset of these common string formatting expressions are optimized:
44+
45+ * F-strings
46+ * ``"...".format(...) ``
47+ * ``"..." % (...) ``
48+
3749Functions
3850---------
3951
40- * ``len(s: str) ``
41- * ``ord(s: str) ``
52+ * ``len(s: str) ``
53+ * ``ord(s: str) ``
You can’t perform that action at this time.
0 commit comments