def __init__(self, name = None, methodCount, locCount, description = None): if(name == None): raise ValueError("Stats.__init__: invalid parm") else: self.theName = name if(description != None): self.theDescription = description self.theMethodCount = methodCount self.theLocCount = locCount
My question is, how does my constructor know which parameters are left out? I know Python is dynamically typed, so if I left out the name, wouldn't it think that methodCount is actually name? How would I pass this?
myStats = stats.Stats(3,15)
Would it automatically, from the statement above, set name and description to None?
This post has been edited by Static Hazard: 27 February 2013 - 09:59 PM