Help setting default class attributes

rh0dium steven.klass at
Thu Sep 6 19:26:34 CEST 2007

Hi all,

I have the following piece of code and I wanted to set the default
attributes based on a dictionary. What I am looking for is a way to
take PIPODEFAULTS and assign each one as an attribute for the class
pipo.  Can someone show me how to do this by iterating over the
PIPODEFAULTS and assign them.  What I would expect to be able to do is
call the class and modify them.

a = pipo()
print a.caseSensitivity

a.caseSensitivity = "lower"
print a.caseSensitivity

Lastly - here is my code:

class pipo:

    PIPODEFAULTS={ "caseSensitivity" : "preserve","cellMapTable" :
"","checkPolygon" : "nil","compression" : "none",
                   "convertDot" : "ignore","convertPathToPoly" :
"nil","convertToGeo" : "nil","dumpPcellInfo" : "nil",
                   "snapToGrid" : "nil","techFileChoice" :
"nil","units": "micron","useParentXYforText" : "nil","viewName" :

    def __init__(self, *args, **kwargs):
        """This simply will run a PIPO stream out
        # Setup Logging

    def setdefaults(self):
        for x in self.PIPODEFAULTS:
            self.log.debug("Setting %s to %s" % (x,

More information about the Python-list mailing list