A Few Python Tips
In this tech talk, Sumana Harihareswara will be presenting a few tips to help you work effectively with Python. This talk is aimed at experienced programmers who are accustomed to other scripting languages, and to new programmers for whom Python is their first language. This is a practice talk before Sumana delivers this talk at the Open Source Bridge conference the following week.
If you would like to follow along, please bring a laptop and install Python in advance.
This talk will cover several tools or Python features that are helpful when programming in Python:
pipfor package management
virtualenvwrapperto 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 -ito 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!)
- PEP 8 and the
pep8script to find style issues
pep8ifyto fix just the style issues that bother you
- PEP 8 and the
- A few favorite modules, inside and outside of the standard library
randomincluding Sumana's favorite weird features
requests(“HTTP For Humans”)
coverage.pyto systematically reason about your code
codecsto melt away UTF-8 and Unicode problems
This talk will not discuss programming basics, why you might choose to work in Python, web frameworks such as Django and Flask, Wikimedia Python projects such as Wikimetrics and pywiki and mwclient and mwparserfromhell, or scientific computing distributions such as scipy and numpy. As a followup to this talk, the audience might enjoy watching ten-minute Crucial Python videos or fixing a small bug in Wikimetrics.