[Tutor] When to use def __init__ when making a class?

brandon w thisisonlyatest at gmx.com
Wed Aug 3 02:47:10 CEST 2011


I have two questions:

1)  When should I use "def __init__(self):" when I create a class?

2)  Would these two classes have the same effect?

class Name:
         def __init__(self):
                 man = Marcus
                 woman = Jasmine
                 return self.man, self.woman



class Name:
         man = Marcus
         woman = Jasmine
         return man, woman


More information about the Tutor mailing list