On Mon, 05 Nov 2007 13:30:24 +0100, Andrew Bettisonwrote: > Is there any reason why the PersistentList.data_is class attribute is > not used when instantiating the PersistentList.data instance attribute? > > To be specific, here are the first lines of the PersistentList > definition: > > >>> class PersistentList (PersistentObject): > ... """ > ... Instance attributes: > ... data : list > ... """ > ... __slots__ = ['data'] > ... > ... data_is = list > ... > ... def __init__(self, *args, **kwargs): > ... self.data = list(*args, **kwargs) The ${attr}_is class attribute naming convention is for facilitating use of the qp.lib.spec data validation module. I admit here it looks a bit cryptic, especially as it is not actually used within durus code, but I guess it is provided for convenience of applications that choose to use it. All the other durus persistent classes also have it: $ find ./durus -name "*.py" -exec grep "_is " {} \; -ls s_is = set 196988 8 -rw-r--r-- 1 ruggier users 4230 Oct 19 2006 ../durus/persistent_set.py bnode_class.items_is = [tuple] bnode_class.nodes_is = (None, [bnode_class]) root_is = BNode 196990 16 -rw-r--r-- 1 ruggier users 15912 Apr 23 2007 ../durus/btree.py data_is = dict 196994 4 -rw-r--r-- 1 ruggier users 2977 Nov 1 2006 ../durus/persistent_dict.py data_is = list 196998 4 -rw-r--r-- 1 ruggier users 3938 Nov 1 2006 ../durus/persistent_list.py Anyhow, the spec module supports a convention that class attributes ending with "_is" are there simply to state the acceptable data type for the implied instance attribute, i.e. the one named the same without the "_is". It can be quite a handy way to fine-grain define, and check, your attribute data types. Look at the source code and comments of qp.lib.spec for how this is used, and maybe for some concrete examples also at the classes in qp.pub.user and qp.pub.session.