Python Classes

Erik Jones erik at myemma.com
Tue Aug 28 11:08:06 EDT 2007


On Aug 28, 2007, at 12:04 AM, Lamonte Harris wrote:

> How come you have to set the initialized created variables to equal  
> the parameters, shouldn't that be default?
>
> class testing:
>          def __init__(self,testing):
>                    self.testing = testing
> x = testing("testing")
> print x.testing
>
>
> How come self.testing = testing
>
> Can someone explain that in more detail, just confused on why you  
> have to set it up like that.
> -- 

Simple Answer:

Because language should never set variable values "by default".   
That's what programmers are for.  There may be application domains  
where *some* defaulting behavior makes sense, but that's what  
frameworks and DSLs are for.

Erik Jones

Software Developer | Emma®
erik at myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com





More information about the Python-list mailing list