Table of Contents

Class: Dict oops/core.py

Persistent dictionary.

Important attributes:

__dictkeys__
a keyspace for the dictionary's items.
Base Classes   
dict
Obj
Methods   
__clear__
__cmp__
__contains__
__copyfrom__
__delitem__
__eq__
__ge__
__getitem__
__gt__
__init__
__iter__
__le__
__len__
__lt__
__moveto__
__ne__
__nonzero__
__repr__
__setitem__
__setval__
clear
copy
get
has_key
items
iteritems
iterkeys
itervalues
keys
popitem
setdefault
update
values
  __clear__ 
__clear__ ( self )

Delete all data associated to this node and all contained subnodes.

Overloaded to delete all dict items.

  __cmp__ 
__cmp__ ( self,  other )

Comparison operator.

Overloaded to more adaquately compare Dict to other values.

  __contains__ 
__contains__ ( self,  key )

Test if self has data associated to `key`.

  __copyfrom__ 
__copyfrom__ ( self,  other )

Make `self` a copy of `other`.

Overloaded to copy over dictionary items and keyspace.

  __delitem__ 
__delitem__ ( self,  key )

Index operator for dictionary item deletion.

If no value is associated to `key`, raises KeyError.

  __eq__ 
__eq__ ( self,  other )

Test for equality.

  __ge__ 
__ge__ ( self,  other )

Test for greater of equal to.

  __getitem__ 
__getitem__ ( self,  key )

Index operator for dictionary item retrieval.

If no value is associated to `key`, raises KeyError.

Exceptions   
KeyError( key )
  __gt__ 
__gt__ ( self,  other )

Test for greater than.

  __init__ 
__init__ (
        self,
        initval=None,
        **keywords,
        )

Constructor.

Accepted arguments:

initval
initial value for the dictionary. Calls __setval__.
  __iter__ 
__iter__ ( self )

Return a iterator of the dictionary's keys

  __le__ 
__le__ ( self,  other )

Test for lesser or equal to.

  __len__ 
__len__ ( self )

Return the number of dictionary items.

  __lt__ 
__lt__ ( self,  other )

Test for lesser than.

  __moveto__ 
__moveto__ (
        self,
        database,
        path=(),
        parent=None,
        )

Move the node to a new location.

Overloaded to copy over dictionary items and keyspace.

  __ne__ 
__ne__ ( self,  other )

Test for inequality.

  __nonzero__ 
__nonzero__ ( self )

Tests for emptyness.

Return true (1) if the dictionary has 1 or more items.

  __repr__ 
__repr__ ( self )

String representation of a Dict instance.

Overloaded to better represent the Dict instance's value.

  __setitem__ 
__setitem__ (
        self,
        key,
        value,
        )

Index operator for dictionary item assignment.

If __oftype__ is not None & type(value) is not the same as __oftype__ this raises a TypeError.

  __setval__ 
__setval__ ( self,  value )

Set the node's value.

Accepts instances the python builtin dict and derived classes.

Exceptions   
TypeError( "value must be instance of dict" )
  clear 
clear ( self )

Deletes all dictionary items.

  copy 
copy ( self )

Returns a python dictionary filled with all the dictionary items stored in `self`.

  get 
get (
        self,
        key,
        default,
        )

Return value associated to `key`. If there is no data, return `default`.

  has_key 
has_key ( self,  key )

Return true (1) is self has data associated to `key`. Return false (0) otherwise.

  items 
items ( self )

Returns a list of key-value pairs represented by tuples in the format (key, value).

  iteritems 
iteritems ( self )

Returns an iterator that iterates over all the key-value pairs in this dictionary.

  iterkeys 
iterkeys ( self )

Return an iterator that iterates over all the keys of this dictionary.

  itervalues 
itervalues ( self )

Returns an iterator that iterates over all the values stored in this dictionary.

  keys 
keys ( self )

Return a list of all the keys that have data associated to them.

  popitem 
popitem ( self,  *args )

Return a (non-specific) key-value pair.

If the dictionary is empty, this raises a KeyError.

  setdefault 
setdefault (
        self,
        key,
        default,
        )

If no data is associated to `key`, associate value `default` to it.

  update 
update ( self,  extension )

Update the current dictionary with values `from extension`.

extension can be either a python dictionary, an instance of UserDict or an instance of Dict.

  values 
values ( self )

Returns a list of all the values stored in this dictionary.


Table of Contents

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