Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Python/Module5_OddsAndEnds/Writing_Good_Code.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,16 @@ The following is a summary some of the most critical members of the `typing` mod

- Hint a function that takes in a string and an integer and returns `None`: `Callable[[str, int], None]`
- Hint a method that accepts arbitrary arguments and returns a boolean: `Callable[..., bool]`


#### `Literal[<value>, ...]`

- **What it hints:** That the variable will be passed one of the exact values
- **Examples:**

- Hint that a variable that will be the integer `1`: `Literal[1]`
- Hint that a variable that will be the either the string `"sum"` or the string `"mean"`: `Literal["sum", "mean"]`
- Hint that a variable that will be either the list `[1, 2]` or the string `"abc"`: `Literal[[1, 2], "abc"]`
- **Compatibility Note:** The `Literal` type-hint was introduced in Python 3.8 - it is not available in earlier versions of Python.

<!-- #region -->
Let's take, for example, a function that takes in:
Expand Down
2 changes: 1 addition & 1 deletion Python/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ What this is
------------
Python Like You Mean It (PLYMI) is a free resource for learning the basics of Python & NumPy, and moreover, becoming a competent Python user. The features of the Python language that are emphasized here were chosen to help those who are particularly interested in STEM applications (data analysis, machine learning, numerical work, etc.).

I want this to be a lean, one-stop resource for learning the essentials of Python from scratch. The reader will begin by learning about what Python is and what installing Python even means, and will hopefully walk away with a solid understanding of a substantial core of the language and its premiere numerical library, NumPy. I am also placing an emphasis on best practices throughout this site and am teaching to the latest version of Python (version 3.6, as of writing this).
I want this to be a lean, one-stop resource for learning the essentials of Python from scratch. The reader will begin by learning about what Python is and what installing Python even means, and will hopefully walk away with a solid understanding of a substantial core of the language and its premiere numerical library, NumPy. I am also placing an emphasis on best practices throughout this site and am teaching to the latest version of Python (version 3.8, as of writing this).


What this isn't
Expand Down
2 changes: 1 addition & 1 deletion Python/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ What this is
------------
Python Like You Mean It (PLYMI) is a free resource for learning the basics of Python & NumPy, and moreover, becoming a competent Python user. The features of the Python language that are emphasized here were chosen to help those who are particularly interested in STEM applications (data analysis, machine learning, numerical work, etc.).

I want this to be a lean, one-stop resource for learning the essentials of Python from scratch. The reader will begin by learning about what Python is and what installing Python even means, and will hopefully walk away with a solid understanding of a substantial core of the language and its premiere numerical library, NumPy. I am also placing an emphasis on best practices throughout this site and am teaching to the latest version of Python (version 3.7, as of writing this).
I want this to be a lean, one-stop resource for learning the essentials of Python from scratch. The reader will begin by learning about what Python is and what installing Python even means, and will hopefully walk away with a solid understanding of a substantial core of the language and its premiere numerical library, NumPy. I am also placing an emphasis on best practices throughout this site and am teaching to the latest version of Python (version 3.8, as of writing this).


What this isn't
Expand Down