Utah Python Meeting May 2015 - The Many Faces of Python Descriptors - Eric Snow

17 views
Skip to first unread message

Clint Savage

unread,
Apr 21, 2015, 11:47:28 AM4/21/15
to Utah Python List
The Many Faces of Python Descriptors by Eric Snow

One wonderful aspect of Python is that you can use it to great effect
without knowing about any of its power features.  However, to get the
most out of Python it's a great idea to broaden your knowledge of
features like metaclasses, the import system, and "special" methods.

This talk will reveal a key power feature that plays an important role
in customizing attribute lookup: descriptors.  Even if you have never
heard of descriptors, this discussion will matter to you.  You may not
realize it but you use descriptors constantly.  Some examples are
methods, staticmethod, classmethod, and property.  For those that
already have a good handle on descriptors, expect to get an even
deeper understanding.  I plan on doing the same. :)

I would classify this talk as intermediate level.  However, even
beginners should be able to follow along and leave with useful tools.

Rough Outline:

* attribute lookup (dotted access syntax)
  + object.__getattribute__
  + special method lookup
  + descriptor getters
* components of descriptors
  + __get__, __set__, __delete__
  + "data-only" descriptors
  + inspect.isdatadescriptor, etc.
* examples
  + methods
  + property (descriptor as a decorator)
* permutations of descriptor components
  + classmethod
  + staticmethod
  + classonly
  + ...
* bonus: a few fun descriptors
  + lazy attributes
  + reverse name binding
  + placeholders
* summary
* questions

-- Where --

Needle.com
14864 S. Pony Express Road
Bluffdale, Utah 84065
Map: http://goo.gl/maps/EEhw9

-- When --

Thursday, May 14, 2014 @ 7pm

Cheers,

herlo

Reply all
Reply to author
Forward
0 new messages