Passing values to a class

Jay Collins jcollin at
Tue Feb 27 21:26:32 EST 2001

Anyone shed some light on what I'm doing stupid/wrong here:

import dbm

class db:
        def __init__(self,base):
                print "using database",base
        def createdb(self):
                d =,"n")
                d['name'] = "Jim Smith"

app = db("databse")

how come createdb() doesn't see base? Maybe I'm not getting class scope
correctly. My idea was to pass what database I wanted to work on for that
instance. Then I could call the methods to do work on the data in it.

More information about the Python-list mailing list