Mod1ObjOri.py (496B)
1 2 """ 3 Class mod1 for tests 4 5 Doctest examples: 6 7 >>> a = Mod1Class("pippo") 8 >>> a.getMyName() 9 'pippo from obj1 _init_' 10 11 >>> a = Mod1Class("pLuTo") 12 >>> a.getMyName() 13 'pLuTo from obj1 _init_' 14 15 """ 16 17 class Mod1Class(object): 18 19 def __init__(self, pName): 20 """ 21 Constructor stores pName in myName and appends the class string marker 22 """ 23 self.val = 1 24 self.myName = pName + " from obj1 _init_" 25 26 def getMyName(self): 27 """ 28 getMyName in Mod1Class returns the name as is 29 """ 30 return self.myName