t.p.r.AccessorType(type) : class documentation

Part of twisted.python.reflect View Source View In Hierarchy

Metaclass that generates properties automatically.

This is for Python 2.2 and up.

Using this metaclass for your class will give you explicit accessor methods; a method called set_foo, will automatically create a property 'foo' that uses set_foo as a setter method. Same for get_foo and del_foo.

Note that this will only work on methods that are present on class creation. If you add methods after the class is defined they will not automatically become properties. Likewise, class attributes will only be used if they are present upon class creation, and no getter function was set - if a getter is present, the class attribute will be ignored.

This is a 2.2-only alternative to the Accessor mixin - just set in your class definition:

   __metaclass__ = AccessorType
Method __init__ Undocumented
def __init__(self, name, bases, d): (source)
Undocumented
API Documentation for Twisted, generated by pydoctor at 2013-04-03 11:20:05.