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

## Class AccessorType

    object --+
             |
          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, dict)`
a new object with type S, a subtype of T | ``__new__`(S, ...)` T.__new__(S, ...) -> a new object with type S, a subtype of T

Method Details

### __new__(S, ...) T.__new__(S, ...) -> a new object with type S, a subtype of T Returns: a new object with type S, a subtype of T

Generated by Epydoc 1.1 on Thu May 8 13:18:57 2003 | http://epydoc.sf.net