Skip to content

Commit

Permalink
fix(#263): Advertise underscore_separation for function names
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohany committed Nov 29, 2024
1 parent eed1dce commit eff6535
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions ch05construction/02conventions.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,14 @@ def add_to_reaction(a_name,
# ## Naming Conventions

# %% [markdown]
# [Camel case](https://en.wikipedia.org/wiki/Camel_case) is used in the following example, where class name is in UpperCamel, functions in lowerCamel and underscore_separation for variables names. This convention is used broadly in the python community.
# [Camel case](https://en.wikipedia.org/wiki/Camel_case) is used for class names in the following example, while function and variable names follow snake_case (underscore_separation). This convention is widely used in the Python community, as stated in [PEP 8](https://pep8.org/).

# %%
class ClassName:
def methodName(variable_name):
def method_name(variable_name):
instance_variable = variable_name


# %% [markdown]
# This other example uses underscore_separation for all the names.

# %%
class class_name:
def method_name(a_variable):
m_instance_variable = a_variable


# %% [markdown]
# ## Hungarian Notation

Expand Down

0 comments on commit eff6535

Please sign in to comment.