Skip to content

Commit b69bb13

Browse files
committed
updates
1 parent 3090fdc commit b69bb13

18 files changed

+323
-168
lines changed

cheatsheet.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,81 @@ len(<dict>) # Find the length of the diction
296296

297297
A dictionary can also contain many dictionaries, this is called nested dictionaries.
298298

299+
### Dictionary unpacking
300+
301+
A double asterisk `**` denotes dictionary unpacking. Its operand must be a mapping. Each mapping item is added to the new dictionary. Later values replace values already set by earlier dict items and earlier dictionary unpackings.
302+
303+
Originally proposed by [PEP 448](https://peps.python.org/pep-0448/).
304+
305+
306+
#### Simple Dictionary Unpacking Example
307+
308+
1. Define the Function
309+
310+
```python
311+
def make_sandwich(protein, cheese, sauce, extras=None):
312+
"""Prints the ingredients of a customized sandwich."""
313+
314+
sandwich = f"A {protein} sandwich"
315+
316+
if cheese:
317+
sandwich += f" with {cheese}"
318+
319+
if sauce:
320+
sandwich += f" and {sauce} on it"
321+
322+
if extras:
323+
sandwich += f" (plus {extras})"
324+
325+
print(sandwich)
326+
```
327+
328+
329+
2. Define the Configuration Dictionary
330+
331+
We create a **dictionary** where the **keys** match the **keyword argument names** of the function (`protein`, `cheese`, `sauce`, etc.).
332+
333+
```python
334+
# Our sandwich configuration stored in a dictionary
335+
sandwich_settings = {
336+
'protein': 'turkey',
337+
'cheese': 'provolone',
338+
'sauce': 'mayo',
339+
'extras': 'lettuce and tomato'
340+
}
341+
```
342+
343+
3. Use the Unpacking Operator (`**`)
344+
345+
We call the function and use `**` to unpack the dictionary. The `**` operator turns the dictionary's key-value pairs into individual keyword arguments.
346+
347+
```python
348+
# Unpack the dictionary into keyword arguments
349+
make_sandwich(**sandwich_settings)
350+
```
351+
352+
**Output:**
353+
354+
```
355+
A turkey sandwich with provolone and mayo on it (plus lettuce and tomato)
356+
```
357+
358+
**What the `**` Does**
359+
360+
The line `make_sandwich(**sandwich_settings)` is functionally equivalent to writing:
361+
362+
```python
363+
make_sandwich(
364+
protein='turkey',
365+
cheese='provolone',
366+
sauce='mayo',
367+
extras='lettuce and tomato'
368+
)
369+
```
370+
371+
The `**` operator is a clean way to pass a dynamic or pre-configured set of arguments to a function.
372+
373+
299374
### Tuple
300375

301376
A tuple is a collection which is ordered, indexed and unchangeable. In Python tuples are written with round brackets.

generatedfiles/books.md

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
:::{grid-item-card}
1010
:link: https://jakevdp.github.io/WhirlwindTourOfPython/
11-
{octicon}`smiley;1em;caption-text` **A Whirlwind Tour of Python**
11+
{octicon}`megaphone;1em;caption-text` **A Whirlwind Tour of Python**
1212
^^^
1313
A Whirlwind Tour of Python is a fast-paced introduction to essential features of the Python language, aimed at researchers and developers who are already familiar with programming in another language.
1414
+++
@@ -18,7 +18,7 @@ A Whirlwind Tour of Python is a fast-paced introduction to essential features of
1818

1919
:::{grid-item-card}
2020
:link: https://github.com/dabeaz-course/python-mastery
21-
{octicon}`bookmark;1em;caption-text` **Advanced Python Mastery**
21+
{octicon}`checklist;1em;caption-text` **Advanced Python Mastery**
2222
^^^
2323
An exercise-driven course on Advanced Python Programming that was battle-tested several hundred times on the corporate-training circuit for more than a decade. Written by David Beazley.
2424
+++
@@ -28,7 +28,7 @@ An exercise-driven course on Advanced Python Programming that was battle-tested
2828

2929
:::{grid-item-card}
3030
:link: https://www.thedigitalcatbooks.com/pycabook-introduction/
31-
{octicon}`zap;1em;caption-text` **Clean Architectures in Python**
31+
{octicon}`bookmark;1em;caption-text` **Clean Architectures in Python**
3232
^^^
3333
This book is about a software design methodology. With lots of Python examples and a strong emphasis on TDD.
3434
+++
@@ -38,7 +38,7 @@ This book is about a software design methodology. With lots of Python examples a
3838

3939
:::{grid-item-card}
4040
:link: https://runestone.academy/ns/books/published/fopp/index.html
41-
{octicon}`book;1em;caption-text` **Foundations of Python Programming**
41+
{octicon}`heart;1em;caption-text` **Foundations of Python Programming**
4242
^^^
4343
This book is to teach you to understand and create computer programs in Python. With hands-on activities!
4444
+++
@@ -48,7 +48,7 @@ This book is to teach you to understand and create computer programs in Python.
4848

4949
:::{grid-item-card}
5050
:link: https://www.labri.fr/perso/nrougier/from-python-to-numpy/
51-
{octicon}`telescope;1em;caption-text` **From Python to Numpy**
51+
{octicon}`heart;1em;caption-text` **From Python to Numpy**
5252
^^^
5353
The goal of this book is to explain advanced techniques for using Numpy.
5454
+++
@@ -58,17 +58,31 @@ The goal of this book is to explain advanced techniques for using Numpy.
5858

5959
:::{grid-item-card}
6060
:link: https://developers.google.com/edu/python
61-
{octicon}`checklist;1em;caption-text` **Google's Python Class**
61+
{octicon}`file;1em;caption-text` **Google's Python Class**
6262
^^^
6363
Free online course book for people with a little bit of programming experience who want to learn Python
6464
+++
6565
[Read more or use this reference »](https://developers.google.com/edu/python)
6666
:::
6767

6868

69+
:::{grid-item-card}
70+
:link: https://leanpub.com/insidethepythonvirtualmachine/read
71+
{octicon}`light-bulb;1em;caption-text` **Inside The Python Virtual Machine**
72+
^^^
73+
74+
```{image} https://d2sofvawe08yqg.cloudfront.net/insidethepythonvirtualmachine/s_shelf?1721860161
75+
:height: 100px
76+
```
77+
Inside the Python Virtual Machine provides a guided tour under the covers of the Python interpreter for the curious pythonista. It attempts to show the user what happens from the moment the user executes a piece of Python code to the point when the interpreter returns the result of executing the piece of code.
78+
+++
79+
[Read more or use this reference »](https://leanpub.com/insidethepythonvirtualmachine/read)
80+
:::
81+
82+
6983
:::{grid-item-card}
7084
:link: https://book.pythontips.com/en/latest/index.html
71-
{octicon}`tools;1em;caption-text` **Intermediate Python**
85+
{octicon}`tag;1em;caption-text` **Intermediate Python**
7286
^^^
7387
The topics which are discussed in this book open up your mind towards some nice corners of Python language.
7488
+++
@@ -78,7 +92,7 @@ The topics which are discussed in this book open up your mind towards some nice
7892

7993
:::{grid-item-card}
8094
:link: https://learningds.org/intro.html
81-
{octicon}`hubot;1em;caption-text` **Learning Data Science**
95+
{octicon}`check-circle;1em;caption-text` **Learning Data Science**
8296
^^^
8397
Principles and Techniques of Data Science: This open book is tailored for ML! (Python numpy, classification etc)
8498
+++
@@ -88,7 +102,7 @@ Principles and Techniques of Data Science: This open book is tailored for ML! (P
88102

89103
:::{grid-item-card}
90104
:link: https://pythonbook.org/
91-
{octicon}`pencil;1em;caption-text` **Professional Python Programming**
105+
{octicon}`bookmark;1em;caption-text` **Professional Python Programming**
92106
^^^
93107
Open access book that covers topics that are important for a professional programmer.
94108
+++
@@ -98,7 +112,7 @@ Open access book that covers topics that are important for a professional progr
98112

99113
:::{grid-item-card}
100114
:link: https://www.labri.fr/perso/nrougier/python-opengl/
101-
{octicon}`pencil;1em;caption-text` **Python & OpenGL for Scientific Visualization**
115+
{octicon}`checklist;1em;caption-text` **Python & OpenGL for Scientific Visualization**
102116
^^^
103117
he goal of this book is to reconciliate Python programmers with OpenGL, providing both an introduction to modern OpenGL and a set of basic and advanced techniques in order to achieve both fast, scalable & beautiful scientific visualizations.
104118
+++
@@ -108,7 +122,7 @@ he goal of this book is to reconciliate Python programmers with OpenGL, providin
108122

109123
:::{grid-item-card}
110124
:link: https://jakevdp.github.io/PythonDataScienceHandbook/
111-
{octicon}`checklist;1em;caption-text` **Python Data Science Handbook**
125+
{octicon}`project;1em;caption-text` **Python Data Science Handbook**
112126
^^^
113127
A book about doing data science with Python.
114128
+++
@@ -118,7 +132,7 @@ A book about doing data science with Python.
118132

119133
:::{grid-item-card}
120134
:link: https://py-pkgs.org/welcome
121-
{octicon}`thumbsup;1em;caption-text` **Python Packages**
135+
{octicon}`project;1em;caption-text` **Python Packages**
122136
^^^
123137
Python Packages is an open source book that describes modern and efficient workflows for creating Python packages.
124138
+++
@@ -128,7 +142,7 @@ Python Packages is an open source book that describes modern and efficient workf
128142

129143
:::{grid-item-card}
130144
:link: https://www.tomasbeuzen.com/python-programming-for-data-science/README.html
131-
{octicon}`file;1em;caption-text` **Python Programming for Data Science**
145+
{octicon}`briefcase;1em;caption-text` **Python Programming for Data Science**
132146
^^^
133147
Covers everything you need to know to start using Python for data science.
134148
+++
@@ -138,7 +152,7 @@ Covers everything you need to know to start using Python for data science.
138152

139153
:::{grid-item-card}
140154
:link: https://python-programming.quantecon.org/intro.html
141-
{octicon}`briefcase;1em;caption-text` **Python Programming for Economics and Finance**
155+
{octicon}`file;1em;caption-text` **Python Programming for Economics and Finance**
142156
^^^
143157
Python for scientific computing, with a focus on economics and finance.
144158
+++
@@ -148,7 +162,7 @@ Python for scientific computing, with a focus on economics and finance.
148162

149163
:::{grid-item-card}
150164
:link: https://wesmckinney.com/book/
151-
{octicon}`note;1em;caption-text` **Python for Data Analysis, 3E**
165+
{octicon}`stack;1em;caption-text` **Python for Data Analysis, 3E**
152166
^^^
153167
This book is concerned with the nuts and bolts of manipulating, processing, cleaning, and crunching data in Python.
154168
+++
@@ -158,7 +172,7 @@ This book is concerned with the nuts and bolts of manipulating, processing, clea
158172

159173
:::{grid-item-card}
160174
:link: https://goodresearch.dev/
161-
{octicon}`telescope;1em;caption-text` **The Good Research Code Handbook**
175+
{octicon}`pencil;1em;caption-text` **The Good Research Code Handbook**
162176
^^^
163177
Handbook is for all who do a lot of programming as part of their research. It will teach you, in a practical manner, how to organize your code so that it is easy to understand and works reliably.
164178
+++
@@ -168,7 +182,7 @@ Handbook is for all who do a lot of programming as part of their research. It wi
168182

169183
:::{grid-item-card}
170184
:link: https://docs.python-guide.org/
171-
{octicon}`tag;1em;caption-text` **The Hitchhiker’s Guide to Python**
185+
{octicon}`hubot;1em;caption-text` **The Hitchhiker’s Guide to Python**
172186
^^^
173187
Python Best Practices Guidebook.
174188
+++
@@ -178,7 +192,7 @@ Python Best Practices Guidebook.
178192

179193
:::{grid-item-card}
180194
:link: https://www.pyopensci.org/python-package-guide/index.html
181-
{octicon}`project;1em;caption-text` **pyOpenSci Python Package Guide**
195+
{octicon}`bookmark;1em;caption-text` **pyOpenSci Python Package Guide**
182196
^^^
183197
Learn how to create a Python package from start to finish. Also great tutorials for writing test, documentation and more!
184198
+++

generatedfiles/commercialcompanies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
:::{grid-item-card}
1010
:link: https://www.anaconda.com/
11-
{octicon}`bookmark;1em;caption-text` **Anaconda**
11+
{octicon}`stack;1em;caption-text` **Anaconda**
1212
^^^
1313
Anaconda sits at the center of the AI revolution. We provide data science tools, MLOps, and data & model management to empower our customers and community with AI capabilities to propel their projects forward.
1414
+++
@@ -18,7 +18,7 @@ Anaconda sits at the center of the AI revolution. We provide data science tools,
1818

1919
:::{grid-item-card}
2020
:link: https://astral.sh/
21-
{octicon}`tag;1em;caption-text` **Astral**
21+
{octicon}`bookmark;1em;caption-text` **Astral**
2222
^^^
2323
Next-gen Python tooling
2424
+++

generatedfiles/communities.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
:::{grid-item-card}
1010
:link: https://conda.org/
11-
{octicon}`package;1em;caption-text` **Conda Community**
11+
{octicon}`cross-reference;1em;caption-text` **Conda Community**
1212
^^^
1313
A community supporting a language-agnostic, multi-platform package management ecosystem for projects of any size and complexity.
1414
+++
@@ -18,7 +18,7 @@ A community supporting a language-agnostic, multi-platform package management ec
1818

1919
:::{grid-item-card}
2020
:link: https://jazzband.co/
21-
{octicon}`megaphone;1em;caption-text` **Jazzband**
21+
{octicon}`thumbsup;1em;caption-text` **Jazzband**
2222
^^^
2323
Jazzband is a collaborative community to share the responsibility of maintaining Python-based projects.
2424
+++
@@ -28,7 +28,7 @@ Jazzband is a collaborative community to share the responsibility of maintaining
2828

2929
:::{grid-item-card}
3030
:link: https://palletsprojects.com/
31-
{octicon}`light-bulb;1em;caption-text` **Pallets**
31+
{octicon}`hubot;1em;caption-text` **Pallets**
3232
^^^
3333
Pallets is the open source community organization that develops and supports popular Python frameworks.
3434
+++
@@ -38,7 +38,7 @@ Pallets is the open source community organization that develops and supports pop
3838

3939
:::{grid-item-card}
4040
:link: https://pydata.org/
41-
{octicon}`project;1em;caption-text` **PyData**
41+
{octicon}`file;1em;caption-text` **PyData**
4242
^^^
4343
PyData is an educational program of NumFOCUS, a 501(c)(3) nonprofit charity.
4444
+++
@@ -48,7 +48,7 @@ PyData is an educational program of NumFOCUS, a 501(c)(3) nonprofit charity.
4848

4949
:::{grid-item-card}
5050
:link: https://docs-community.readthedocs.io/index.html
51-
{octicon}`zap;1em;caption-text` **Python Documentation Community**
51+
{octicon}`eye;1em;caption-text` **Python Documentation Community**
5252
^^^
5353
The Documentation Team will be contributors to documentation who participate regularly to CPython documentation and monthly meetings (synchronously or asynchronously). A goal of this team will be to build a global community around CPython documentation.
5454
+++
@@ -58,7 +58,7 @@ The Documentation Team will be contributors to documentation who participate reg
5858

5959
:::{grid-item-card}
6060
:link: https://scientific-python.org
61-
{octicon}`zap;1em;caption-text` **The Scientific Python project**
61+
{octicon}`tag;1em;caption-text` **The Scientific Python project**
6262
^^^
6363
The scientific Python ecosystem is a loose federation of community-developed and -owned Python projects widely used in scientific research, technical computing, and data science.
6464
+++

generatedfiles/datascience.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:gutter: 2
88

99
:::{grid-item-card}
10-
{octicon}`stack;1em;caption-text` **Foundations of Data Science with Python**
10+
{octicon}`thumbsup;1em;caption-text` **Foundations of Data Science with Python**
1111
^^^
1212

1313
```{image} https://github.com/jmshea/Foundations-of-Data-Science-with-Python/raw/main/images/3d-book.png
@@ -21,7 +21,7 @@ Learn data visualization, statistics, probability, and dimensionality reduction
2121

2222
:::{grid-item-card}
2323
:link: https://learningds.org/intro.html
24-
{octicon}`stack;1em;caption-text` **Learning Data Science**
24+
{octicon}`cross-reference;1em;caption-text` **Learning Data Science**
2525
^^^
2626
Principles and Techniques of Data Science: This open book is tailored for ML! (Python numpy, classification etc)
2727
+++

generatedfiles/foundations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
:::{grid-item-card}
1010
:link: https://numfocus.org/
11-
{octicon}`project;1em;caption-text` **NumFOCUS**
11+
{octicon}`tools;1em;caption-text` **NumFOCUS**
1212
^^^
1313
NumFOCUS is to promote open practices in research, data, and scientific computing
1414
+++
@@ -17,7 +17,7 @@ NumFOCUS is to promote open practices in research, data, and scientific computin
1717

1818

1919
:::{grid-item-card}
20-
{octicon}`hubot;1em;caption-text` **WheelNext**
20+
{octicon}`project;1em;caption-text` **WheelNext**
2121
^^^
2222
WheelNext is an open-source initiative (https://github.com/wheelnext & https://wheelnext.dev/) aiming to improve the user experience in the Python packaging ecosystem, specifically around the scientific computing and machine/deep learning space. We also anticipate benefits in other domains that heavily rely on performance of compiled Python extension modules - the benefit of utilizing one's hardware more optimally is not exclusive to any single domain.
2323
+++
@@ -27,7 +27,7 @@ WheelNext is an open-source initiative (https://github.com/wheelnext & https://w
2727

2828
:::{grid-item-card}
2929
:link: https://www.pyopensci.org/python-package-guide/index.html
30-
{octicon}`project;1em;caption-text` **pyOpenSci**
30+
{octicon}`tag;1em;caption-text` **pyOpenSci**
3131
^^^
3232
Community that supports free and open Python tools for processing scientific data.
3333
+++

0 commit comments

Comments
 (0)