[Tutor] class to function

Alex Kleider akleider at sonic.net
Sun May 25 18:48:10 CEST 2014


On 2014-05-25 09:20, R. Alan Monroe wrote:
>> can you
>> guys help explain. super thanks
> 
> A class is like a blueprint.
> An instance of that class is like a house built from that blueprint.
> 
> Think about it. An infinite number of houses could be constructed
> using those blueprints. But the architect only had to draw them once.
> 
> __init__() is like the "foundation" of each house that is built. In
> otherwords, the stuff you do first when construction commences.
> 
> Alan

I very much like this analogy but might I suggest a slight modification?
  __init__() builds the house, and possibly provides minimum 
furnishings[1] (with parameters passed to init;)  then your code 
(usually using the associated methods) flushes out the furnishings[1] 
(and makes use of them) as the needs of your program demand.
[1] 'furnishings' in this analogy are DATA
Does this fit?  Comments welcome.
Respectively submitted,
ak


More information about the Tutor mailing list