Passing default class attributes across modules

Paul Simmonds psimmo60 at hotmail.com
Thu Oct 24 05:45:15 EDT 2002


Hi all,

Having read Steve Holden's plugins post, I've now changed my classes so that 
they can be imported from the dataclass module (eventually the data is to be 
held in XML format, so this is an intermediate).

However, I still need to be able to choose which class to use. Ideally, the 
call for the code in my OP would go something like:

from dataclass import *
classdialog=ClassListDialog(classname=Knight,
                            title="The Knights of the Round Table",
                            list=knightlist)

Then, adding an item to the list in the dialog would go:

    def AddInstance(self,item):
        self.list.append(self.classname)

Unfortunately, when I try this, and then dir() the new instance, I get the 
string object methods, so it's taking the name as string, not as object. Is 
there a way of converting the types?

TIA,
Paul



_________________________________________________________________
Broadband? Dial-up? Get reliable MSN Internet Access. 
http://resourcecenter.msn.com/access/plans/default.asp





More information about the Python-list mailing list