Skip to content

Commit 89b17d2

Browse files
committed
explaining pass thanks Esxiel
1 parent 824fffb commit 89b17d2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

basics/classes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ Let's use it to define an empty class.
7777
>>>
7878
```
7979

80+
The `pass` is needed here, just like [when defining functions that do
81+
nothing](defining-functions.md#first-functions).
82+
8083
Note that I named the class `Website`, not `website`. This way we know
8184
that it's a class. Built-in classes use lowercase names (like `str`
8285
instead of `Str`) because they are faster to type, but use CapsWord

basics/defining-functions.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,14 @@ Let's use it to define a function that does nothing.
6868
>>>
6969
```
7070

71-
Seems to be working so far, we have a function. Actually it's just
72-
a value that is assigned to a variable called `do_nothing`. Let's see
73-
what happens if we call it.
71+
Seems to be working so far, we have a function. It's just a value that
72+
is assigned to a variable called `do_nothing`.
73+
74+
The `pass` is needed here because without it, Python doesn't know when
75+
the function ends and it gives us a syntax error. We don't need the
76+
`pass` when our functions contain something else.
77+
78+
Let's see what happens if we call our function.
7479

7580
```python
7681
>>> do_nothing()

0 commit comments

Comments
 (0)