Python Like You Mean It

Written by Ryan Soklaski (Twitter/GitHub:@rsokl)

Edited by David Mascharka

中文版 (Chinese Version)

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.9, as of writing this). This material has proven to be fruitful for high school and college teachers alike to teach Python as part of their STEM curriculum.

What this isn’t

This is not even close to being an exhaustive treatment of the Python language, and is not sufficient to become a “complete” Python user. But it will hopefully provide a solid enough foundation that acquiring those missing pieces will be relatively easy.

This is also not a deep “Python for Data Science” resource. It will not teach you how to use machine learning and data analysis libraries like sci-kit learn and Pandas. That being said, NumPy is such a critically-important library that it has deeply influenced essentially all of the other major STEM-related Python libraries (e.g. sci-kit, TensorFlow, PyTorch, Pandas). The NumPy content presented here will serve as a cornerstone for working with all of these libraries down the road.

What about Python textbooks?

Books and blogs can be great. I personally think that programming books can be overwhelming because they are required to be so complete; it is hard for a someone new to a language to distill the essentials of the Python language from hundreds of pages of text. Furthermore, it simply makes more sense to make this sort of material available digitally; users should be able to easily search the site, view it on mobile devices, copy code snippets, and know that the content is being kept up-to-date.

Python shouldn’t be too easy

Python is a relatively easy language to pick up, and it doesn’t require much rigor to make code work. Unfortunately, this means that there are many Python users out there who know enough to just get by, but lack a sound understanding of the language. You don’t want to get caught in the “know enough Python to be dangerous” zone; therein lies complacency, stagnation, and the genesis of a lot of bad code. You’ve got to Python like you mean it!

Join Our Discussion Board

Join the PLYMI community to ask questions, recommend new content, or to just say hello!

(A note to BWSI students: please stick to your class’ piazza board for posting questions)

PLYMI is on GitHub

If you have questions about the reading, think that you have spotted some mistakes, or would like to contribute to PLYMI, please visit our GitHub page. You will need to create a GitHub account in order to post an issue; this process is free and easy. We would love for you to join us to discuss the website!

Contributors

The following people made significant contributions to PLYMI, adding problems with worked solutions and valuable feedback on the text:

About Me

I started learning to use Python in graduate school for my physics research, and I was so bad at using it. Fortunately, one of my labmates was more experienced and had the good sense to tell me that my code and work flow was terrible. He pointed me to tooling, style guides, and documentation pages so that I could improve (I’d like to think that this resource would have been a huge help to me back then). I’ve been coding in Python for at least ten years now, and I’ve taken to following the language, along with its new features and changes, quite closely. Currently I do machine learning research, and have served as a core developer for a machine learning library. I also love to teach, so this has been a fun project for me to take on!

Here are some other open source projects that I have created:

  • MyGrad: Adds drop-in automatic differentiation to NumPy

  • hydra-zen: Configurable, reproducible, and scalable workflows in Python, via Hydra

Table of Contents:

Indices and tables