Learn More Python
Hi! Your skill level is beginner or intermediate, or even advanced. You want to learn more Python. There are plenty of resources out there, and this is just a curated list of links. Some for each skill level. It's not everything and the kitchen sink, but it's not all "must-read" either. You should feel free to skip around.
A note on approach: I agree with Learn X the Hard Way that the "hard way" — learning by doing — diving right in — is actually the easy way. So new or not, let's jump in.
The first key is Don't Panic. You can learn most by hands-on experience. A significant benefit of a language like Python, is how learnable it is by jumping into an interactive session. Rapid feedback.
If you have not installed Python yet, you need to pick a version of Python and then install. For both of these subjects, you should read Hitchhiker's Guide to Python. UPDATE in 2019: start with Python 3!
It's also a good idea to debunk the myths you may have heard about Python:
- PayPal Engineering Blog: 10 Myths of Enterprise Python -- read this post whether are new to Python or not. It's great, and useful.
As for why to learn it (and ignore the bellyachers who are wasting their time telling you what to learn):
- python.org → "Success Stories"
- this Quora thread on some other famous cases
- this more general Quora thread about why dynamic languages are found in startups and innovative environments. Remember, you are not saying no to other languages. You are just equipping yourself with more. And it's fun god-dammit.)
If nobody’s told you yet, Python’s community is one of the most important things about it :) Join forums, subreddits (/r/Python, /r/learnpython), chats (Slacks or IRCs) local meetups, etc., and get support. You’ll learn much better with a community.
Keep these handy.
- The official docs! https://docs.python.org/2/
- Learn X in Y Minutes: Python is a good cheat sheet.
- Flow-chart to help you get past common Python error messages
Courses and books
If you like self-guided courses, try one of these:
- Learn Python the Hard Way
- RealPython: "Real Python teaches programming and web development through hands-on, interesting examples that are useful and fun!" (paid)
- or Dive into Python (the classic). (Note that Dive into Python 3 only covers new & advanced features in Python 3 - not the language as a whole. Don't start there if you're new to Python) (free)
- or Google's Python Introduction course (free)
- or How to Think Like a Computer Scientist: Learning with Python, Interactive Edition (free) — if you're relatively new to programing, this is an especially good fit for you
If you like taking online courses with a group, I’ve heard this one is good:
A good IDE will help you be more productive!
A lot of people think when you're first learning a language like Python, you'll grok it best if you use a basic text editor instead of an IDE. Still, maybe you are just here to learn a little Python for some projects at work, and you just need to get some things done. An IDE might help you.
- I strongly prefer JetBrains PyCharm. So do most people at my company now. And many many people the world over … PyCharm does incredible things with your Python code.
- There's a free Community Edition you can use immediately.
(Another side note on text editors vs. IDEs. Even if you like the lean text editor side of things - vim or Emacs, Sublime Text... Well, I still think you should check out PyCharm. I hated disliked IDEs for a long time until I tried PyCharm. Vim users, take a look at "Epic Review of PyCharm [...] From a Vim User's Perspective" (and "Part 2". The vim emulation is solid, I use it every day.)
Interactive tools for understanding Python better
- ipython and ipython notebook - you should be using these!!!
- There's also Python's built-in debugger,
pdb, and the ipython variant (autocomplete etc)
- Use PyCharm's debugger, it is excellent. JetBrains PyCharm docs: Debugging
Avoiding common mistakes and pitfalls
Free book (PDF): How to make mistakes in Python
One of Python's biggest strengths is its testability. Test-Driven Development and Python go together happily.
- start with this concise post, http://docs.python-guide.org/en/latest/writing/tests/#the-basics
- then try this comprehensive post. It's about unit testing with Python's Standard Library unit test package, but leads you up to introducing pytest — the best runner for any kind of tests (you can get started on that right away). It’s also the best framework for writing data-driven tests, when you’re ready to get gung-ho about testing your code :D
- Jeff Knupp: Improve your Python Understanding - Unit Testing
- When you’re ready, move onto pytest, definitely :) pytest.md
For intermediate and advanced Pythonistas
Are you intermediate or advanced? If you're not sure, one way to check:
- Ask yourself Python Interview Questions and see if you know them. If you don't, try and learn more
- Read some of "Good to Great Python Reads", a nice index of great Python reading (good to Ctrl+F for topics)
You don’t need to read style guides until you’re beyond beginner status. At some point that will become very valuable and helpful to you :)
There are two main style guides:
- The Hitchhiker's Guide to Python – opinionated guide by the legendary Kenneth Reitz of requests fame
- Google Python Style Guide – perhaps the most widely-used Python style guide
Not comprehensive, but when I brain-dumped some really good things to know about, I wrote down these subjects.
Unicode is pretty sad in Python 2, so if you're using Python 2 you should learn the gotchas and fixes ASAP...
Functional programming, list comprehensions, etc.
Security, with this bent: learning general skills to get into InfoSec or AppSec
Machine Learning! Here’s my guide: Dive into Machine Learning
You're probably going to use libraries to do a lot of things. When you have a new scenario and you are thinking what should I use... You should:
- Ask your community :D
- check Hitchhiker's Guide to Python: Scenario Guide for Python Applications
- check Full Stack Python, another comprehensive but carefully curated guide, full of useful context, advice, etc.
- check Awesome Python, "A curated list of awesome Python frameworks, libraries, software and resources" — or the Pythonidae list
Fast and scalable Python - Concurrency, Parallelism
Nice cheat sheet on various non-beginner topics in Python 3
For completely out-of-the-box Python, concurrency is slightly complicated (because of the GIL). However, it's not some no-man's-land or something. You don't need to rediscover the solution on your own. The best single summary I've seen of (preferred) concurrency options –
There are loads of options... Greenlet, Twisted. I must say, while I've used those, I tend to go for parallelism with Celery if it makes sense. While it's a different solution, it can be relevant to some of the same problems you might be trying to solve.
Parallelism/ distributed task queue
For Python projects that need some horizontal scale-out and fast performance, there's a good chance a worker-and-queue setup might work better for you, compared with single-computer concurrency. There's no question: Celery is the way to go for worker-and-queue systems in Python --
Map/Reduce and beyond (Functional Reactive Programming)
Or maybe not worker-and-queue. I've maintained some pretty iffy worker-and-queue systems. These days I reach for Apache Spark instead. Batch and stream processing, in a portable fashion, with a very declarative and maintainable API (thanks to Functional Reactive Programming).
Use these links to further expand your knowledge base.
r/LearnPython Wiki - Plethora of useful resources including video lectures, useful tools, and communities for learning competetive programming to keep you on an edge.
Learn Python the Hard Way (Book) - This is an excellent beginner programmer’s guide to Python. It covers “hello world” from the console to the web.
svaksha's python resources - More books, a beginner's guide to Git, blog posts on Python/CS/Data Science, videos, and workshop tutorials.
Hitchhikker's Guide to Python learning resources - Links to good python books/guides. This book itself is a practical approach to learning Python. It assumes you already know the basics, and teaches you when & how to use Python. Read this book for a more example-driven approach.
Think Like A Computer Scientist - Interactive python guide. Also includes programming a GUI, Recursion, Classes & Objects, and includes interesting game examples.
Writing a program and none of the guides/docs are helping out? Ask real programmers for help on Stackoverflow