Mastering Python... Best Resources?

Chris Angelico rosuav at gmail.com
Fri Aug 26 08:44:28 EDT 2011


On Fri, Aug 26, 2011 at 10:33 PM, Travis Parks <jehugaleahsa at gmail.com> wrote:
> I know the Python syntax pretty well. I know a lot of the libraries
> and tools. When I see professional Python programmer's code, I am
> often blown away with the code. I realized that even though I know the
> language, I know nothing about using it effectively.

I would say that there are three aspects to using Python effectively:

1) Understanding the syntax, which you've mastered.
2) Understanding the philosophy
3) Knowing algorithms.

The second is more or less what you're asking for, but the
language-independent third may be more useful to you. This is correct
Python syntax (#1), and decently Pythonic style (#2), but a hopelessly
flawed algorithm (#3):

def fib(x):
    return fib(x-1) + fib(x-2) if x>2 else 1

Or:

def fib(x):
    if x<3: return 1
    return fib(x-1) + fib(x-2)

Both versions are clean and easy to read, but neither would be what
I'd call brilliant code.

You can get books on algorithms from all sorts of places, and with a
very few exceptions, everything you learn with apply to Python and
also to every other language you use.

ChrisA



More information about the Python-list mailing list