gems in the python standard library
TRANSCRIPT
Gems in the Python Standard Library
Jason Scheirer
Cool stuff!
• File formats
• Compression
• Algorithms and data structures
• Networking
• Package distribution
• All built in!
File formats
CSV
JSON
• Simple python data structures to/from JSON strings
• Use in conjunction with urllib2 for great success!
XML
• Three options:
- DOM (familiar to Javascript developers)
- SAX (event driven, big data)
- ElementTree (feels like Python)
XML
XML
XML
XML
XML
Compression
• GZip compression
-
• ZipFile
- Access zip file’s contents
- Put data in:
- Get data out:
Algorithms and data structures
Algorithms and data structures
• : Functional programming
• and : A great combination
Algorithms and data structures
Algorithms and data structures
• : Useful data structures
•
• (you probably want this a LOT)
Algorithms and data structures
• : C-style data structures
• Equivalent to:
Algorithms and data structures
• : Memory-efficient homogenous arrays
• You probably want , but this is nice too
Networking
• module for low-level TCP programming
• Probably care more about HTTP though
Networking (HTTP)
• Kind of messy organization in Python 2.X
• Fetching:
• Parsing:
Package distribution
• Distutils
• You can provide Windows installers (.exe or .msi) for
your code libraries
• Semi-automatic compilation of C/C++ libraries
Package distribution
• Layout:
•
• Setup.py:
Package distribution
•
• Setup.py:
Package distribution
Package distribution
•
QUESTIONS