Skip to content

Commit

Permalink
[readme] formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
apalala committed Nov 12, 2023
1 parent 2f2b8c0 commit 39498a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ default argument values produces in Python.

What follows is not intuitive for newcomers to Python, but it's something that everyone learns quickly:

```python-repl
```python
>>> def f(x=[]):
... x.append(1)
... return x
Expand All @@ -42,7 +42,7 @@ invocation, so using mutable values produces the above results.
The coding pattern to work around the above is to use ``None`` as the initializer, and check for
the parameter value at the start of the function code:

```python-repl
```python
>>> def f(x=None):
... if x is None:
... x = []
Expand Down

0 comments on commit 39498a6

Please sign in to comment.