Python Like You Mean It¶
What this is¶
Python Like You Mean It 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).
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 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!
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 workflow 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 six 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!
- Python Like You Mean It
- Module 1: Getting Started with Python
- Module 2: The Essentials of Python
- Basic Object Types
- Sequence Types
- Variables & Assignment
- Introducing Control Flow
- Conditional Statements
- For-Loops and While-Loops
- Generators & Comprehension Expressions
- Python’s “Itertools”
- Basics of Functions
- Data Structures (Part I): Introduction
- Data Structures (Part II): Dictionaries
- Data Structures (Part III): Sets & the Collections Module
- Module 3: The Essentials of NumPy
- Introducing the ND-array
- Accessing Data Along Multiple Dimensions in an Array
- Basic Array Attributes
- Functions for Creating NumPy Arrays
- Iterating Over Arrays & Array-Traversal Order
- “Vectorized” Operations: Optimized Computations on NumPy Arrays
- Array Broadcasting
- Introducing Basic and Advanced Indexing
- Advanced Indexing
- Module 4: Object Oriented Programming
- Module 5: Odds and Ends