Return to Snippet

Revision: 14640
at June 8, 2009 12:33 by cthulhupunk0


Initial Code
class itemDict:
    """
    ********************************************
    *Description : Aggregator for items
    *******************************************
    """

    def __init__(self, init_items = {}):
        """
        ********************************************
        * Description : constructor.  Optionally initializes
        *   the item dictionary
        *******************************************
        """

        self.items = init_items
        self.dictConf()
    def dictConf(self):
        """
        ********************************************
        *Description : Generic post-constructor function
        *******************************************
        """
        pass

    def add_item(self, item):
        """
        ********************************************
        *Description : adds an item to the dictionary
        *   or reassigns an item already present
        *******************************************
        """

        self.items[item["public_name"]] = item

    def del_item(self, name):
        """
        ********************************************
        *Description : deletes an item from the dictionary
        *******************************************
        """

        del self.items[name]

Initial URL

                                

Initial Description

                                

Initial Title
Aggregator class for a dictionary of individual items

Initial Tags

                                

Initial Language
Python