I am reading python since last 15 days ,read some basics of python , Last night was reading about the OOPS concepts ,but getting some problems , going to discuss with you people.
MY CODE : I made a class with the name student that prints simply name of the student as well as his roll_no also, pasting code here . code: class student: def __init__(self,name,roll_no): self.name=name self.roll_no def display(self): print 'name',self.name,'roll_no',self.roll_no s1=student("sudhanshu",21) s2=student("rahul",22) s1.display() s2.display() student is a class name problem 1: Why we always use first method as a __init__ problem 2: why we put first argument as a self inside the __init__ parentheses if __init__ is a constructor then how it works. How I can run this code , working on ubuntu : but when write inside the terminal python filename.py but it shows nothing regards password
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor