Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo fixes that can mislead the reader #193

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dataviz/tutorial_source/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def visualize_days():
# Assign the data to a plot
plt.plot(data_list)

# Assign labels to the plot from day_list
# Assign labels to the plot from day_tuple
plt.xticks(range(len(day_tuple)), day_tuple)

# Save the graph!
Expand Down
2 changes: 1 addition & 1 deletion website/_containers/dataviz/2013-01-04-part-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ In order to read a CSV/Excel file, we have to import the `csv` module from Pytho
import csv
```

`MY_FILE` is defining a global - notice how it‘s all caps, a convention for variables we won't be changing. Included in this repo is a sample file to which this variable is assigned.
`MY_FILE` is defining a constant - notice how it‘s all caps, a convention for variables we won't be changing the value of. Included in this repo is a sample file to which this variable is assigned.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python doesn’t have real constants: as the text says, it’s a human convention to use all caps and not change them, but it’s not something enforced by the language.

I’m also -1 on the other change: Python has objects and names, not variables with values. http://nedbatchelder.com/text/names.html

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are called constants though in PEP-0008: https://www.python.org/dev/peps/pep-0008/#constants. Globals aren't necessarily the same thing, they can be any variable declared at the module level whereas a "constant" is identified as a full caps variable at the module level. Though Python won't treat them differently there's a semantic difference and certain expectations on them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least there is someone to support me. @daenney 👍


```python
MY_FILE = "../data/sample_sfpd_incident_all.csv"
Expand Down