Table of Contents

Class: Definition oops/core.py

Class definition (container for units).

The Definition class is the metaclass for Obj. This allows one to build classes with typed attributes rapidly with very little overhead:

>>> class Person(Obj): ... name = Text() ... age = Int() ... >>> p = Person() >>> p.name = "Mr. Bubbles" >>> "name" in vars(p) # the name attribute is in the class definition 0 >>> print p.name # and its value is stored in the database Mr. Bubbles >>> p.__unitkeys__ # nonzero units stored in __unitkeys__ ['name'] >>> p.age = 10 >>> p.__unitkeys__ [name, 'age'] >>> del p.name, p.age >>> p.__unitkeys__ []

Base Classes   
type
Methods   
__init__
__setattr__
  __init__ 
__init__ (
        self,
        name,
        bases,
        dict,
        )

Constructor.

Overloaded to handle Unit instances in the class' initial namespace.

Arguments:

name
the class name at declaration time.
bases
the base classes of the new class.
dict
the class's namespace at declaration time.
  __setattr__ 
__setattr__ (
        self,
        name,
        value,
        )


Table of Contents

This document was automatically generated on Mon Feb 18 01:32:24 2002 by HappyDoc version 2.0.1