Skip to content

Commit 4902dac

Browse files
docs(data types): Allign docs and clean redaction.
1 parent fff67ae commit 4902dac

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

docs/pages/language/data-types.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ b
104104
c
105105
```
106106

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).
108108

109109
## Bytes
110110

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 0255). Distinct from `str`: stores raw octets, not Unicode. Indexing returns an `int`, not a single-byte slice.
112112

113113
```python
114114
data = b"hello"
@@ -178,7 +178,7 @@ print(encoded, decoded)
178178
b'Edge Python' Edge Python
179179
```
180180

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"`.
182182

183183
## List
184184

@@ -237,7 +237,7 @@ print(xs)
237237

238238
## Tuple
239239

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).
241241

242242
```python
243243
t = (1, 2, 3)
@@ -256,7 +256,7 @@ print(()) # empty
256256

257257
## Dict
258258

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.
260260

261261
```python
262262
d = {"a": 1, "b": 2}
@@ -279,7 +279,7 @@ print(list(d.items()))
279279
```python
280280
# Iteration yields keys
281281
for k in {"x": 1, "y": 2}:
282-
print(k)
282+
print(k)
283283
```
284284

285285
```text Output

0 commit comments

Comments
 (0)