- Use IPython.
- Start with PEP 8
- Then look at Django
- Prefer importing a module over classes or functions inside that module. It makes it easier to see where things belong. This isn't a hard-and-fast rule, just a suggestion. G
# Good. from django.contrib import auth auth.login(...) # Not so good. from django.contrib.auth import login login(...)
- Avoid backslashes. Wrap things in parens instead.
# Gross. jibberjabber = one.long.name + two.long.name + three.long.name + \ four.long.name # Lovely. jibberjabber = (one.long.name + two.long.name + three.long.name + four.long.name)
- Continuation lines should line up with the opening parens. G
# mmmhmmm. the_answer = sum(one, two, three, four, five, six) # This is ok too. the_answer = sum( one, two, three, four, five, six) # oh no. the_answer = sum(one, two, three, four, five, six)
- Break the rules if you think it would improve readability.
- Use pip and virtualenv and virtualenvwrapper. Zamboni packaging docs