Package oort :: Package util :: Module code :: Class SlotStruct
[hide private]
[frames] | no frames]

Class SlotStruct

source code

object --+
         |
        SlotStruct
Known Subclasses:
sitebase.AppUtil, sitebase.Current

Base class for making "struct" types with members defined by their __slots__ value. Example:

>>> class Item(SlotStruct):
...     __slots__ = 'first', 'last'
>>> item1 = Item(first='a', last='b')
>>> item1.first, item1.last
('a', 'b')
>>> item1.middle = '-'
Traceback (most recent call last):
...
AttributeError: 'Item' object has no attribute 'middle'
>>> item2 = Item('a', 'b')
>>> assert (item1.first, item1.last) == (item2.first, item2.last)
>>> assert item1.make_dict() == {'first': 'a', 'last': 'b'}


Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__str__(self)
str(x)
source code
 
make_dict(self) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 
str(x)
Overrides: object.__str__
(inherited documentation)