twisted.python.reflect.AccessorType

Package twisted :: Package python :: Module reflect :: Class AccessorType |
[frames | no frames]

## Class AccessorType

    type --+
           |
          AccessorType

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 Summary
| `__init__(self, name, bases, d)`
Inherited from type
| `__call__(...)`
| `__cmp__(...)`
| `__delattr__(...)`
| `__getattribute__(...)`
| `__hash__(...)`
| `__new__(...)`
| `__repr__(...)`
| `__setattr__(...)`
| `__subclasses__(...)`
| `mro(...)`
Inherited from object
| `__reduce__(...)`
| `__str__(...)`

Generated by Epydoc 2.0 on Sat May 15 20:08:02 2004 | http://epydoc.sf.net