Meetings/2014-06-19
A Few Python Tips
[edit]Video: https://plus.google.com/events/c4rjtirsfsn0am6jqhpjob6eakc
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:
- Setup
pip
for package managementvirtualenv
andvirtualenvwrapper
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 statepdb
, the Python debuggersys.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
- PEP 8 and the
- A few favorite modules, inside and outside of the standard library
random
including Sumana's favorite weird featuresrequests
(“HTTP For Humans”)unittest
andcoverage.py
to systematically reason about your codecodecs
to 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.