You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/language/data-types.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,11 +104,11 @@ b
104
104
c
105
105
```
106
106
107
-
`len(s)` and padding (`str.center` / `str.zfill`) measure in code points, not bytes,`'ñ'.center(5, '*')` -> `'**ñ**'` (5 visual chars).
107
+
`len(s)` and padding (`str.center` / `str.zfill`) measure in code points, not bytes —`'ñ'.center(5, '*')` -> `'**ñ**'` (5 visual chars).
108
108
109
109
## Bytes
110
110
111
-
Immutable sequence of bytes (each 0,255). Distinct from `str`: stores raw octets, not Unicode. Indexing returns an `int`, not a single-byte slice.
111
+
Immutable sequence of bytes (each 0–255). Distinct from `str`: stores raw octets, not Unicode. Indexing returns an `int`, not a single-byte slice.
112
112
113
113
```python
114
114
data =b"hello"
@@ -178,7 +178,7 @@ print(encoded, decoded)
178
178
b'Edge Python' Edge Python
179
179
```
180
180
181
-
`bytes` is hashable and comparable to other `bytes`; `bytes == str` is always `False` (even for valid UTF-8). Methods: `decode`, `hex`, `startswith`, `endswith`. Encodings: `"utf-8"` (default), `"ascii"`.
181
+
`bytes` is hashable and comparable to other `bytes`; `bytes == str` is always `False` (even for valid UTF-8). Methods include `decode`, `hex`, `find`, `count`, `replace`, `split`, `startswith`, `endswith` (see [Methods](/reference/methods)). Encodings: `"utf-8"` (default), `"ascii"`.
182
182
183
183
## List
184
184
@@ -237,7 +237,7 @@ print(xs)
237
237
238
238
## Tuple
239
239
240
-
Immutable sequence. Fastest container for fixed-size data; the only one usable as a dict key in mixed-type cases.
240
+
Immutable sequence. Fastest container for fixed-size data, and the usual hashable container for compound dict keys (frozensets also work).
241
241
242
242
```python
243
243
t = (1, 2, 3)
@@ -256,7 +256,7 @@ print(()) # empty
256
256
257
257
## Dict
258
258
259
-
Insertion-ordered mapping. Keys must be hashable: numbers, strings, bytes, bools, `None`, frozensets, tuples of hashables. Mutable containers as keys -> `TypeError: unhashable type`. Numerically equal keys (`1`/`1.0`, `True`/`1`) collapse, second insertion overwrites.
259
+
Insertion-ordered mapping. Keys must be hashable: numbers, strings, bytes, bools, `None`, frozensets, tuples of hashables. Mutable containers as keys -> `TypeError: unhashable type`. Numerically equal keys (`1`/`1.0`, `True`/`1`) collapse; the second insertion overwrites.
0 commit comments