Skip to content

Commit

Permalink
Add dict.clear to the spec (#233)
Browse files Browse the repository at this point in the history
Fixes #230
  • Loading branch information
laurentlb authored Mar 15, 2023
1 parent 6c22f40 commit e2175b4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ interact with the environment.
* [zip](#zip)
* [Built-in methods](#built-in-methods)
* [bytes·elems](#bytes·elems)
* [dict·clear](#dict·clear)
* [dict·get](#dict·get)
* [dict·items](#dict·items)
* [dict·keys](#dict·keys)
Expand Down Expand Up @@ -3450,6 +3451,18 @@ list(b"ABC".elems()) # [65, 66, 67]
```
<!-- TODO: signpost how to convert an single int or list of int to a bytes. -->

<a id='dict·clear'></a>
### dict·clear

`D.clear()` removes all the entries of dictionary D and returns `None`.
It fails if the dictionary is frozen or if there are active iterators.

```python
x = {"one": 1, "two": 2}
x.clear() # None
print(x) # {}
```

<a id='dict·get'></a>
### dict·get

Expand Down

0 comments on commit e2175b4

Please sign in to comment.