Say What You Mean: Meta-Programming a Declarative API

Dr. Ryan F Kelly
30min ◊◊ Intermediate
Sunday 11:00am, Grand Lodge
categories: core, language

This talk will explore the use of python's meta-programming facilities to create a simple declarative API so that you can *say what you mean* - write code that focuses on the what and the why without being cluttered by the how. If you've ever wondered how the Django ORM or SQLObject work their magic, this is the talk for you.
 
As motivating example and case study, I will build from scratch a basic clone of the "dexml" module, which lets you work with XML documents in a declarative, object-oriented manner. Through judicious use of decorators, descriptors and metaclasses, it packs a lot of logic and functionality into a very thin API.


files Files:





# Permalink