Skip to content

Commit 6f47959

Browse files
jonathanwheeler01Jon Wheeler
andauthored
03-index-slice-subset.md: a comment on reserved words (#354)
Fixes #351 Co-authored-by: Jon Wheeler <jwheel01@unm.edu>
1 parent 83e1804 commit 6f47959

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

_episodes/03-index-slice-subset.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@ Python tells us what type of error it is in the traceback, at the bottom it says
106106
`KeyError: 'speciess'` which means that `speciess` is not a valid column name (nor a valid key in
107107
the related Python data type dictionary).
108108

109+
> ## Reminder
110+
> The Python language and its modules (such as Pandas) define reserved
111+
> words that should not be used as identifiers when assigning objects
112+
> and variable names. Examples of reserved words in Python include Boolean values
113+
> `True` and `False`, operators `and`, `or`, and `not`, among others. The full list
114+
> of reserved words for Python version 3 is provided at
115+
> <https://docs.python.org/3/reference/lexical_analysis.html#identifiers>.
116+
>
117+
> When naming objects and variables, it's also important to avoid using
118+
> the names of built-in data structures and methods. For example, a _list_ is a built-in
119+
> data type. It is possible to use the word 'list' as an identifier for a new object,
120+
> for example `list = ['apples', 'oranges', 'bananas']`. However, you would then
121+
> be unable to create an empty list using `list()` or convert a tuple to a
122+
> list using `list(sometuple)`.
123+
{: .callout}
124+
109125
## Extracting Range based Subsets: Slicing
110126

111127
> ## Reminder

0 commit comments

Comments
 (0)