Patterns for Improving Expressiveness and Eliminating Redundancy using Decorators, Descriptors, Context Managers, and Metaclasses
Intermediate level, 4 1/2 hours of material, 12n-5p before conference starts, $225
* The Spiderman Rule and Management of Complexity
* Wrapper functions
* Nested namespaces and how closures work
* Pattern for factoring-out common parts of functions
* Project: add_logging
* Project: unbounded_cache()
* Class decorators
* How total_ordering() works
* Preview: use of property() for computed fields
* Overview: How descriptors work
* Project: Develop descriptor based data validators
* Preview: Output redirection with print()
* Most common context managers: files and locks
* Three paths through a content manager
* Project base case: family() help() dis()
* Redirection the hard way
* Redirection the better way
* The type() metaclass
* Customizing type
* Project: Name fix-up for the data validators
This is a hands-on workshop where you develop small projects in parallel with the instructor. Bring your computer!
The level is intermediate python, meaning that you already know how to develop working Python code and can easily manipulate data with core containers and can readily organize your code into functions, classes and modules. You should be reasonably proficient with exception handling and control flow.
If you already know how to write decorators, descriptors, context managers, and meta-classes, this tutorial will be too basic for you. But for everyone else, this will be a great way to open the door to Python's richest tools for writing expressive code and eliminating redundancy.
Raymond has been a prolific contributor to the CPython project for over a decade, having implemented and maintained many of Python's great features. He has been instrumental in modules like bisect, collections, decimal, functools, itertools, math, random, with types like namedtuple, sets, dictionaries, and in many other places around the codebase. He has contributed to the modification of nearly 90,000 lines of code in the CPython repository, and has made over 160 changes in the PEP repository.
Raymond has also served as a director of the Python Software Foundation, and has mentored many people over the years on their contributions to the python-dev community. He's also well known for his contributions to the Python Cookbook, and shares many pieces of Python wisdom on Twitter. He received the Distinguished Service Award at PyCon 2014 for his exceptional contributions to the python community.
Network programming with Python
This is a half-day or 3-hour tutorial from 8:30a - 11:30a with lecture and code demonstrations, $150
AUDIENCE/WHO SHOULD ATTEND and PREREQUISITES [Intermediate]
Developers familiar with Python who are interested in exploring client/server network programming with sockets, how web frameworks work under the covers, and accessing web services & APIs. Bring your laptops and code along with me!!
Python is an agile, cross-platform, object-oriented programming language that is popular for a wide range of applications, one of which is network programming. This tutorial introduces current Python programmers to several areas of network &* web programming, each in self-contained lectures with a demonstration of code following each topic.
TOPICS FOR THIS TUTORIAL
* Socket programming -- underneath all of today's network protocols, i.e., web/HTTP, FTP, database connections, IM conversations, online gaming, e-mail exchange, etc., lies the root communication mechanism, sockets. Here, we introduce client/server architecture and how to program sockets using Python. Together, we'll create a simple TCP client & server as well as a UDP client & server. Time-permitting, we'll look at the TCP code through the eyes of Twisted.
* The heart of simple Web development -- yes, pure CGI is "sooo yesterday," but before you jump on any of Python's popular web frameworks, it's a good idea to learn basics and the basis of how all web servers deliver dynamic content back to the client browser so that you can appreciate all the work that is done on your behalf by a more full-featured framework. The concepts covered here will help you learn frameworks faster!
* Web Services & APIs -- In this final part, we explore web services & APIs. This entails hitting various public URL endpoints serving data in a variety of formats, CSV, JSON, image files, and of course, HTML. Time-permitting, we'll do authorized connections to and get data from Twitter!
This tutorial gives a concise and comprehensive introduction to each of these networking related topics so attendees can start experimenting with and writing applications as soon as they get back to their hotel rooms. Most of the examples/demos in the tutorial can be found in "Core Python Applications Programming". We have had great success and feedback giving derivatives of this tutorial in the past at conferences like OSCON, LISA, and PyCon.