Examples of descriptors?
Mike C. Fletcher
mcfletch at rogers.com
Sat May 31 09:52:42 EDT 2003
Definition:
An object which mediates access to a class instance's attributes via
a specific API.
Examples:
Built-ins property, classmethod, staticmethod.
OpenGLContext's fields -- implement VRML97 field semantics for
scenegraph nodes, with coercian, type-checking, and observability.
Focus on providing consistent, fast representations of field values for
the run-time engine. Implemented as sub-classes of properties at the
moment, though likely to switch to raw descriptor API soon. Includes a
C accelerator module to speed up the __get__ method.
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pyopengl/vrml/field.py?rev=HEAD&content-type=text/vnd.viewcvs-markup
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pyopengl/vrml/fieldtypes.py?rev=HEAD&content-type=text/vnd.viewcvs-markup
wxPython Properties Distribution properties -- generic typed properties,
coercian, type-checking, emphasis on ability to extend the set of
property types readily, (e.g. with unions of types, lists-of-types,
etceteras), focuses mostly on "business" objects and supporting GUI
editing of those objects' properties. Implemented using the raw
descriptor API.
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/wxpypropdist/properties/basicproperty/basic.py?rev=HEAD&content-type=text/vnd.viewcvs-markup
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/wxpypropdist/properties/basicproperty/common.py?rev=HEAD&content-type=text/vnd.viewcvs-markup
Enjoy,
Mike
Edward C. Jones wrote:
> What, exactly, is a "descriptor"? The closest thing to a definition
> that I can find is: a class that defines __get__, __set__, and
> __delete__. Where can I find some examples?
>
> Ed Jones
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
More information about the Python-list
mailing list