A Few Python Tips

*
Accepted Session
Short Form
Beginner
Scheduled: Tuesday, June 24, 2014 from 3:45 – 4:30pm in B201

Excerpt

Nothing fancy here, just several tips that help you work effectively with Python. This talk is licensed CC BY; please feel free to reuse it at your company or conference.

Description

I’ll be demonstrating a bunch of tools or Python features that I found helpful when programming in Python. Follow along with the session notes.

  • Setup
    • pip for package management
    • virtualenv and virtualenvwrapper to keep hygiene between different projects
    • experimenting with different REPLs, especially bpython and IPython, while exploring what you can do with new modules, objects and methods
  • Things to try while debugging
    • python -i to run a script and then spit you out into a REPL afterwards whilst retaining state
    • pdb, the Python debugger
    • sys.path (so often the culprit!)
  • Style
    • PEP 8 and the pep8 script to find style issues
    • pep8ify to fix just the style issues that bother you
  • My favorite modules, inside and outside of the standard library
    • random including my favorite weird features
    • requests (“HTTP For Humans”)
    • unittest and coverage.py to systematically reason about your code
    • codecs to melt away UTF-8 and Unicode problems

This talk is licensed CC BY; please feel free to reuse it at your company or conference.

Tags

python, programming

Speaking experience

I've presented at the past four Open Source Bridge conferences, keynoted code4lib 2014, and given several talks at Wikimedia hackathons and at Hacker School. I've never given this talk before but I've blogged about some of these tools and taught people how to use some of the tools mentioned.

Speaker