Python is a language that can be described as:
"rules you can fit in the
palm of your hand with a huge bag of
hooks".
Nearly everything in python follows the same simple standards. Everything is accessible, changeable, and tweakable. There are very few language level elements.
Take for example, the len(data) builtin function. len(data)
works by simply checking for a data.__len__()
method, and then calls it and returns the value. That way, len()
can work on any object that implements a __len__()
method.
Start by learning about the types and basic syntax:
- Dynamic Strongly Typed Languages
- bool, int, float, string, list, tuple, dict, set
- statements, indenting, "everything is an object"
- basic function definitions
Then move on to learning about how python works:
- imports and modules (really simple)
- the python path (sys.path)
- the
dir()
function
__builtins__
Once you have an understanding of how to fit pieces together, go back and cover some of the more advanced language features:
- iterators
- overrides like
__len__
(there are tons of these)
- list comprehensions and generators
- classes and objects (again, really simple once you know a couple rules)
- python inheritance rules
And once you have a comfort level with these items (with a focus on what makes them pythonic), look at more specific items:
- Threading in python (note the Global Interpreter Lock)
- context managers
- database access
- file IO
- sockets
- etc...
And never forget The Zen of Python (by Tim Peters)
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!