Update simple-serialize.md
This commit is contained in:
parent
25ef2553c7
commit
57971aacb4
|
@ -12,8 +12,7 @@ This is a **work in progress** describing typing, serialization and Merkleizatio
|
||||||
- [Serialization](#serialization)
|
- [Serialization](#serialization)
|
||||||
- [`uintN`](#uintn)
|
- [`uintN`](#uintn)
|
||||||
- [`bool`](#bool)
|
- [`bool`](#bool)
|
||||||
- [Tuples](#lists)
|
- [Tuples, containers, lists](#tuples-containers-lists)
|
||||||
- [Containers, lists](#containers-lists)
|
|
||||||
- [Deserialization](#deserialization)
|
- [Deserialization](#deserialization)
|
||||||
- [Merkleization](#merkleization)
|
- [Merkleization](#merkleization)
|
||||||
- [Self-signed containers](#self-signed-containers)
|
- [Self-signed containers](#self-signed-containers)
|
||||||
|
@ -69,13 +68,15 @@ assert value in (True, False)
|
||||||
return b'\x01' if value is True else b'\x00'
|
return b'\x01' if value is True else b'\x00'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tuples
|
### Tuples, containers, lists
|
||||||
|
|
||||||
|
If `value` is fixed-length (i.e. does not embed a list):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
return ''.join([serialize(element) for element in value])
|
return ''.join([serialize(element) for element in value])
|
||||||
```
|
```
|
||||||
|
|
||||||
### Containers, lists
|
If `value` is variable-length (i.e. embeds a list):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
serialized_bytes = ''.join([serialize(element) for element in value])
|
serialized_bytes = ''.join([serialize(element) for element in value])
|
||||||
|
|
Loading…
Reference in New Issue