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

Class PropertyAccessor

object --+
         |
        PropertyAccessor


A mixin class for Python 2.2 that uses AccessorType.

This provides compatability with the pre-2.2 Accessor mixin, up to a point.

Extending this class will give you explicit accessor methods; a method called set_foo, for example, is the same as an if statement in __setattr__ looking for 'foo'. Same for get_foo and del_foo.

There are also reallyDel and reallySet methods, so you can override specifics in subclasses without clobbering __setattr__ and __getattr__, or using non-2.1 compatible code.

There is are incompatibilities with Accessor - accessor methods added after class creation will *not* be detected. OTOH, this method is probably way faster.

In addition, class attributes will only be used if no getter was defined, and instance attributes will not override getter methods whereas in original Accessor the class attribute or instance attribute would override the getter method.
Method Summary
  reallyDel(self, k)
  reallySet(self, k, v)
    Inherited from object
  __init__(...)
  __delattr__(...)
  __getattribute__(...)
  __hash__(...)
  __reduce__(...)
  __repr__(...)
  __setattr__(...)
  __str__(...)
    Inherited from type
  __new__(...)

Class Variable Summary
type __metaclass__ = twisted.python.reflect.AccessorType

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