Skip to content

Commit

Permalink
use the improved name with verb convert
Browse files Browse the repository at this point in the history
  • Loading branch information
willingc authored and lwasser committed Oct 21, 2024
1 parent 49141f3 commit e1bd3bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clean-modular-code/intro-clean-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ Pythonic code communicates the programmer's intent clearly, making it easier for

Note that the function below has an easy-to-understand name and clear docstring. Some people will even suggest adding a verb that explains what the function does, such as:

`convert_fahr_kelvin()`
`convert_fahrenheit_to_kelvin()`

<!-- #endregion -->

```python editable=true slideshow={"slide_type": ""}
def fahrenheit_to_kelvin(temperature_fahr):
def convert_fahrenheit_to_kelvin(temperature_fahr):
return ((temperature_fahr - 32) * (5 / 9)) + 273.15
```

Expand All @@ -176,7 +176,7 @@ Documentation can mean many different things. When you are writing code, a combi
Pythonic code reflects Python's emphasis on readability and simplicity. A well-known phrase from the **Zen of Python** is: "There should be one—and preferably only one—obvious way to do it," which is a core idea behind writing Pythonic code.

```python
def fahrenheit_to_kelvin(temperature_fahr):
def convert_fahrenheit_to_kelvin(temperature_fahr):
"""
Convert temperature from Fahrenheit to Kelvin.
Expand Down

0 comments on commit e1bd3bf

Please sign in to comment.