[Tutor] constructors

Prahlad Vaidyanathan slime@vsnl.net
Fri, 12 Apr 2002 04:29:25 -0400


Hi,

On Wed, 10 Apr 2002 Erik Price spewed into the ether:
[-- snippity --]
> Since Python is loosely/weakly/dynamically typed, does initializing 
> really matter a great deal?  Or is it just to allow us to use 
> polymorphism in a later method (by not requiring that later method to 

Ok, taking the risk of sounding *very* duh, 

    What does polymorphism mean ?

Going by it's name, it probably involves changing something (method,
variable, etc.) many times. Is this the same as over-riding a method of
the base class during inheritance ?
</wild guess>

> specify a tuple over a list, for instance, because a tuple has already 
> been specified in the constructor, which makes the later method more 
> "general").
> 
> >The __init__ constructor is executed when a class instance is created, 
> >hence you are sure it runs once (at least in "classic" classes; the 
> >rules may have changed for the new-type classes in Python 2.2).
> 
> I am using 2.2 and probably won't need to use an older version.  But can 
> you tell me a bit more about "new-type classes"?  And how they're 
> different from "classic" classes?

I am in the process of reading amk's document, and find the __slots__
attribute extremely cool in preventing some ghastly typos on my part :-)

pv.
-- 
Prahlad Vaidyanathan  <http://www.symonds.net/~prahladv/>

Nothing ever becomes real until it is experienced.
- John Keats