Thursday 1:30 p.m.–3 p.m. in Room 23

The Five Kinds of Python Functions

Steven Lott

Description

Audience level: Intermediate We'll look at the wide variety of ways that we can leverage Python functions. This will show provide helpful background in ordinary functions, as well as callable objects and lambdas. We'll look closely at how to use generator functions, also. The fifth type of function is a function wraps a special method, like len().

Abstract

Garden Variety functions we all know and love. The ideals of idempotency and no hysteresis. Breaking the no-hysteresis rule with callable objects. This can be used for caching previous results. Or it can be used for evil by making functions which are no longer idempotent. Lambda objects and reasons why an anonymous function with only a single expression can be useful. Generator functions and the iterator interface. These can help us avoid creating large data structures in memory. We'll touch on some of the optimization techniques that allow generators to be used recursively. We'll also look at the object model and why we might want to wrap common methods in functions as purely syntactic sugar.Abstrac"