On Tue, Apr 26, 2016 at 2:32 AM, Santanu Jena <santan...@gmail.com> wrote: > Hi Oliver. > I have idea regarding " __init__" method/ class.but still I have confusion > on "def __init__(self): " Please share your under standing.
A big point of an entry point, conceptually, is to establish properties that we'd like to hold. Without such entry points, we don't have any real knowledge on what the shape of our data is at any given point, and our code becomes more complicated because we have to deal with the state of our ignorance. One question we might have is the following: Have we already prepared the program's data to something we expect? Initialization is a particular entry point that guarantees that the only values we get of a particular type are prepared in a certain way. In Python, classes provide an __init__() as an initialization entry point. Without initialization, the rest of our program has this persistent burden of needing to account for what the shape of our data is or isn't. It ends up being a big mosquito of an itch, and a needless one. Rather than pay that cost, we'd rather just eliminate the possibility altogether. That's what initialization is for. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor