mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 14:50:19 +00:00
359 lines
13 KiB
ReStructuredText
359 lines
13 KiB
ReStructuredText
Learning Python
|
|
===============
|
|
|
|
.. image:: https://farm3.staticflickr.com/2840/32800783863_11a00db52c_k_d.jpg
|
|
|
|
Beginner
|
|
--------
|
|
|
|
The Python Tutorial
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
This is the official tutorial. It covers all the basics, and offers a tour of
|
|
the language and the standard library. Recommended for those who need a
|
|
quick-start guide to the language.
|
|
|
|
`The Python Tutorial <http://docs.python.org/tutorial/index.html>`_
|
|
|
|
Python for Beginners
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
thepythonguru.com is a tutorial focuses on beginner programmers. It covers many python concepts
|
|
in depth. It also teaches you some advance constructs of python like lambda expression, regular expression.
|
|
At last it finishes off with tutorial "How to access MySQL db using python"
|
|
|
|
|
|
`Python for beginners <http://thepythonguru.com/>`_
|
|
|
|
Learn Python for Data Science Interactively
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
If you prefer an online interactive environment to learn Python for Data Science, `this free python tutorial by DataCamp <https://www.datacamp.com/courses/intro-to-python-for-data-science?tap_a=5644-dce66f&tap_s=116411-750171>`_ is a great way to get started. If you're already somewhat advanced and interested in machine learning, check out this `course on Supervised Learning with scikit-learn <https://www.datacamp.com/courses/supervised-learning-with-scikit-learn?tap_a=5644-dce66f&tap_s=116411-750171>`_, by one the core developers of scikit-learn.
|
|
|
|
|
|
`Python for data science <http://datacamp.com/?tap_a=5644-dce66f&tap_s=116411-750171>`_
|
|
|
|
Learn Python Interactive Tutorial
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Learnpython.org is an easy non-intimidating way to get introduced to Python.
|
|
The website takes the same approach used on the popular
|
|
`Try Ruby <http://tryruby.org/>`_ website, it has an interactive Python
|
|
interpreter built into the site that allows you to go through the lessons
|
|
without having to install Python locally.
|
|
|
|
`Learn Python <http://www.learnpython.org/>`_
|
|
|
|
|
|
If you want a more traditional book, *Python For You and Me* is an excellent
|
|
resource for learning all aspects of the language.
|
|
|
|
`Python for You and Me <https://pymbook.readthedocs.io/>`_
|
|
`Learn Python Interactively with DataCamp! <https://www.datacamp.com/>`_
|
|
|
|
|
|
Online Python Tutor
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
Online Python Tutor gives you a visual step by step
|
|
representation of how your program runs. Python Tutor
|
|
helps people overcome a fundamental barrier to learning
|
|
programming by understanding what happens as the computer
|
|
executes each line of a program's source code.
|
|
|
|
`Online Python Tutor <http://pythontutor.com/>`_
|
|
|
|
Invent Your Own Computer Games with Python
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
This beginner's book is for those with no programming experience at all. Each
|
|
chapter has the source code to a small game, using these example programs
|
|
to demonstrate programming concepts to give the reader an idea of what
|
|
programs "look like".
|
|
|
|
`Invent Your Own Computer Games with Python <http://inventwithpython.com/>`_
|
|
|
|
|
|
Hacking Secret Ciphers with Python
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
This book teaches Python programming and basic cryptography for absolute
|
|
beginners. The chapters provide the source code for various ciphers, as well
|
|
as programs that can break them.
|
|
|
|
`Hacking Secret Ciphers with Python <http://inventwithpython.com/hacking/>`_
|
|
|
|
|
|
Learn Python the Hard Way
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
This is an excellent beginner programmer's guide to Python. It covers "hello
|
|
world" from the console to the web.
|
|
|
|
`Learn Python the Hard Way <http://learnpythonthehardway.org/book/>`_
|
|
|
|
|
|
Crash into Python
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
Also known as *Python for Programmers with 3 Hours*, this guide gives
|
|
experienced developers from other languages a crash course on Python.
|
|
|
|
`Crash into Python <http://stephensugden.com/crash_into_python/>`_
|
|
|
|
|
|
Dive Into Python 3
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
Dive Into Python 3 is a good book for those ready to jump in to Python 3. It's
|
|
a good read if you are moving from Python 2 to 3 or if you already have some
|
|
experience programming in another language.
|
|
|
|
`Dive Into Python 3 <http://www.diveintopython3.net/>`_
|
|
|
|
|
|
Think Python: How to Think Like a Computer Scientist
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Think Python attempts to give an introduction to basic concepts in computer
|
|
science through the use of the Python language. The focus was to create a book
|
|
with plenty of exercises, minimal jargon and a section in each chapter devoted
|
|
to the subject of debugging.
|
|
|
|
While exploring the various features available in the Python language the
|
|
author weaves in various design patterns and best practices.
|
|
|
|
The book also includes several case studies which have the reader explore the
|
|
topics discussed in the book in greater detail by applying those topics to
|
|
real-world examples. Case studies include assignments in GUI and Markov
|
|
Analysis.
|
|
|
|
`Think Python <http://greenteapress.com/thinkpython/html/index.html>`_
|
|
|
|
|
|
Python Koans
|
|
~~~~~~~~~~~~
|
|
|
|
Python Koans is a port of Edgecase's Ruby Koans. It uses a test-driven
|
|
approach, q.v. TEST DRIVEN DESIGN SECTION to provide an interactive tutorial
|
|
teaching basic Python concepts. By fixing assertion statements that fail in a
|
|
test script, this provides sequential steps to learning Python.
|
|
|
|
For those used to languages and figuring out puzzles on their own, this can be
|
|
a fun, attractive option. For those new to Python and programming, having an
|
|
additional resource or reference will be helpful.
|
|
|
|
`Python Koans <http://bitbucket.org/gregmalcolm/python_koans>`_
|
|
|
|
More information about test driven development can be found at these resources:
|
|
|
|
`Test Driven Development <http://en.wikipedia.org/wiki/Test-driven_development>`_
|
|
|
|
|
|
A Byte of Python
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
A free introductory book that teaches Python at the beginner level, it assumes
|
|
no previous programming experience.
|
|
|
|
`A Byte of Python for Python 2.x <http://www.ibiblio.org/swaroopch/byteofpython/read/>`_
|
|
`A Byte of Python for Python 3.x <https://python.swaroopch.com/>`_
|
|
|
|
|
|
Learn to Program in Python with Codeacademy
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
A Codeacademy course for the absolute Python beginner. This free and interactive course provides and teaches the basics (and beyond) of Python programming whilst testing the user's knowledge in between progress.
|
|
This course also features a built-in interpreter for receiving instant feedback on your learning.
|
|
|
|
`Learn to Program in Python with Codeacademy <http://www.codecademy.com/en/tracks/python>`_
|
|
|
|
|
|
Intermediate
|
|
------------
|
|
|
|
Effective Python
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
This book contains 59 specific ways to improve writing Pythonic code. At 227
|
|
pages, it is a very brief overview of some of the most commons adapations
|
|
programmers need to make to become efficient intermediate level Python
|
|
programmers.
|
|
|
|
`Effective Python <http://www.effectivepython.com/>`_
|
|
|
|
|
|
Advanced
|
|
--------
|
|
|
|
Pro Python
|
|
~~~~~~~~~~
|
|
|
|
This book is for intermediate to advanced Python programmers who are looking to
|
|
understand how and why Python works the way it does and how they can take their
|
|
code to the next level.
|
|
|
|
`Pro Python <http://propython.com>`_
|
|
|
|
|
|
Expert Python Programming
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
Expert Python Programming deals with best practices in programming Python and
|
|
is focused on the more advanced crowd.
|
|
|
|
It starts with topics like decorators (with caching, proxy, and context manager
|
|
case-studies), method resolution order, using super() and meta-programming, and
|
|
general :pep:`8` best practices.
|
|
|
|
It has a detailed, multi-chapter case study on writing and releasing a package
|
|
and eventually an application, including a chapter on using zc.buildout. Later
|
|
chapters detail best practices such as writing documentation, test-driven
|
|
development, version control, optimization and profiling.
|
|
|
|
`Expert Python Programming <http://www.packtpub.com/expert-python-programming/book>`_
|
|
|
|
|
|
A Guide to Python's Magic Methods
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
This is a collection of blog posts by Rafe Kettler which explain 'magic methods'
|
|
in Python. Magic methods are surrounded by double underscores (i.e. __init__)
|
|
and can make classes and objects behave in different and magical ways.
|
|
|
|
`A Guide to Python's Magic Methods <http://www.rafekettler.com/magicmethods.html>`_
|
|
|
|
.. note:: The Rafekettler.com is currently down, you can go to their Github version directly. Here you can find a PDF version:
|
|
`A Guide to Python's Magic Methods (repo on GitHub) <https://github.com/RafeKettler/magicmethods/blob/master/magicmethods.pdf>`_
|
|
|
|
|
|
|
|
For Engineers and Scientists
|
|
----------------------------
|
|
|
|
A Primer on Scientific Programming with Python
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
A Primer on Scientific Programming with Python, written by Hans Petter
|
|
Langtangen, mainly covers Python's usage in the scientific field. In the book,
|
|
examples are chosen from mathematics and the natural sciences.
|
|
|
|
`A Primer on Scientific Programming with Python <http://www.springer.com/mathematics/computational+science+%26+engineering/book/978-3-642-30292-3>`_
|
|
|
|
Numerical Methods in Engineering with Python
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Numerical Methods in Engineering with Python, written by Jaan Kiusalaas,
|
|
puts the emphasis on numerical methods and how to implement them in Python.
|
|
|
|
`Numerical Methods in Engineering with Python <http://www.cambridge.org/us/academic/subjects/engineering/engineering-mathematics-and-programming/numerical-methods-engineering-python-2nd-edition>`_
|
|
|
|
Miscellaneous topics
|
|
--------------------
|
|
|
|
Problem Solving with Algorithms and Data Structures
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Problem Solving with Algorithms and Data Structures covers a range of data
|
|
structures and algorithms. All concepts are illustrated with Python code along
|
|
with interactive samples that can be run directly in the browser.
|
|
|
|
`Problem Solving with Algorithms and Data Structures
|
|
<http://www.interactivepython.org/courselib/static/pythonds/index.html>`_
|
|
|
|
Programming Collective Intelligence
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Programming Collective Intelligence introduces a wide array of basic machine
|
|
learning and data mining methods. The exposition is not very mathematically
|
|
formal, but rather focuses on explaining the underlying intuition and shows
|
|
how to implement the algorithms in Python.
|
|
|
|
`Programming Collective Intelligence <http://shop.oreilly.com/product/9780596529321.do>`_
|
|
|
|
|
|
Transforming Code into Beautiful, Idiomatic Python
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Transforming Code into Beautiful, Idiomatic Python is a video by Raymond Hettinger.
|
|
Learn to take better advantage of Python's best features and improve existing code
|
|
through a series of code transformations, "When you see this, do that instead."
|
|
|
|
`Transforming Code into Beautiful, Idiomatic Python <https://www.youtube.com/watch?v=OSGv2VnC0go>`_
|
|
|
|
|
|
Fullstack Python
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Fullstack Python offers a complete top-to-bottom resource for web development
|
|
using Python.
|
|
|
|
From setting up the webserver, to designing the front-end, choosing a database,
|
|
optimizing/scaling, etc.
|
|
|
|
As the name suggests, it covers everything you need to build and run a complete
|
|
web app from scratch.
|
|
|
|
`Fullstack Python <https://www.fullstackpython.com>`_
|
|
|
|
|
|
References
|
|
----------
|
|
|
|
Python in a Nutshell
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Python in a Nutshell, written by Alex Martelli, covers most cross-platform
|
|
Python's usage, from its syntax to built-in libraries to advanced topics such
|
|
as writing C extensions.
|
|
|
|
`Python in a Nutshell <http://shop.oreilly.com/product/9780596001889.do>`_
|
|
|
|
The Python Language Reference
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
This is Python's reference manual, it covers the syntax and the core semantics
|
|
of the language.
|
|
|
|
`The Python Language Reference <http://docs.python.org/reference/index.html>`_
|
|
|
|
Python Essential Reference
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Python Essential Reference, written by David Beazley, is the definitive reference
|
|
guide to Python. It concisely explains both the core language and the most essential
|
|
parts of the standard library. It covers Python 3 and 2.6 versions.
|
|
|
|
`Python Essential Reference <http://www.dabeaz.com/per.html>`_
|
|
|
|
Python Pocket Reference
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Python Pocket Reference, written by Mark Lutz, is an easy to use reference to
|
|
the core language, with descriptions of commonly used modules and toolkits. It
|
|
covers Python 3 and 2.6 versions.
|
|
|
|
`Python Pocket Reference <http://shop.oreilly.com/product/9780596158095.do>`_
|
|
|
|
Python Cookbook
|
|
~~~~~~~~~~~~~~~
|
|
|
|
Python Cookbook, written by David Beazley and Brian K. Jones, is packed with
|
|
practical recipes. This book covers the core python language as well as tasks
|
|
common to a wide variety of application domains.
|
|
|
|
`Python Cookbook <http://shop.oreilly.com/product/0636920027072.do>`_
|
|
|
|
Writing Idiomatic Python
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
"Writing Idiomatic Python", written by Jeff Knupp, contains the most common and
|
|
important Python idioms in a format that maximizes identification and
|
|
understanding. Each idiom is presented as a recommendation of a way to write
|
|
some commonly used piece of code, followed by an explanation of why the idiom
|
|
is important. It also contains two code samples for each idiom: the "Harmful"
|
|
way to write it and the "Idiomatic" way.
|
|
|
|
`For Python 2.7.3+ <http://www.amazon.com/Writing-Idiomatic-Python-2-7-3-Knupp/dp/1482372177/>`_
|
|
|
|
`For Python 3.3+ <http://www.amazon.com/Writing-Idiomatic-Python-Jeff-Knupp-ebook/dp/B00B5VXMRG/>`_
|