Dear Users,

I'm using global values to create a unique ID, or name for each
instance of a class. If I import the following in one file and test it
it works fine. If the following class was imported in two different
files run by the same program would each instance of the class have a
unique name, or would they only be unique within the scope of the file
which contains the import of the bellow class?

itemID = 0
class AssemblyItem:
    def __init__(self):
        global itemID
        self.ID = "assemblyItem" + str(itemID)
        itemID += 1

Thanks for any help,

Yours Faithfully,

Wesley Brooks
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to