Skip to content
Kamal Banga edited this page Oct 9, 2018 · 62 revisions

Work in Progress 🚧 🏗

This Python 3 wiki is a free mini-book 📘:

⚡️ Python in a Flash: Idioms & Recipes

Contents

  1. Tutorial: For those who know programming in C++/Java and want to learn Python.
  2. Reference 📃: Contains common usage with examples
  3. Idioms 💯: Better/Pythonic ways of doing common tasks
  4. Common Pitfalls ⁉️: Most prominent mistakes and Python quirks
  5. Snippets for Fun and Profit: Coding is best learnt by tinkering with common recipes.

Notation:

  1. >>> means code is being run on python or ipython repl in terminal

Why learn Python?

  • 📈 Python has had incredible growth and is the fastest-growing major programming language.
  • It can do everything data from handling voluminous data (Apache Spark), exploring datasets (Numpy and Pandas), to machine learning (Scikit-learn and PyTorch).
  • 🌏 It harbours one of the most used web frameworks (Django).
  • 💡 It is dynamically typed and hence the learning curve is easy. It has first-class functions which means you can start learning and using it right away instead of the OOP bloat.

Why this book?

  • This book is code-heavy since I myself learnt Python mostly through trying self-contained examples rather than theory.
  • Most code snippets are short and to the point so the particular concept can be grasped in a couple minutes.
  • Ideas in this book are distilled from many great books and blogposts.
  • Prose is succint and emojis filled.

Links to Great Blogposts


Credits

  1. Closures in Common Pitfalls chapter is taken from the book Fluent Python.
  2. Few snippets in Strings section, flattening nested iterable is from the book Python Cookbook, 3rd Ed.
  3. Central Limit Theorem and Pythagorean triplets snippets in Fun chapter are taken from Raymond Hettinger's tweets. The advice of "Specialized tool beats a general purpose tool" also comes from him.
  4. DFS in Fun chapter is taken from Edd Mann's blog.
  5. Example in Floating Point section in Common Pitfalls chapter is taken from Rachel Thomas' Computational Linear Algebra.
  6. Quicksort snippet has been taken from Python Cookbook, 2nd Ed.

Direct links

Iterators

Bell Curve

Clone this wiki locally