Home | Trees | Indices | Help |
---|
|
object --+ | SlotStruct
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'}
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
Inherited from |
|
|
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Mon Oct 29 17:10:15 2007 | http://epydoc.sourceforge.net |