Does Python really follow its philosophy of "Readability counts"?

Roy Smith roy at panix.com
Mon Jan 12 01:00:46 CET 2009


In article 
<34c95e04-5b3f-44bc-a5bf-498518507131 at p36g2000prp.googlegroups.com>,
 "Madhusudan.C.S" <madhusudancs at gmail.com> wrote:

> In such situations, where the Instance variables come into existence
> only when they are used it is very difficult to track the flow of code.

As the saying goes, "It's possible to write Fortran in any language".

My personal habit is to "declare" all instance variables in the __init__() 
method of every class.  If there's no better value, I set them to None.  
This isn't strictly required, but I think it makes it easier for somebody 
reading the code to understand the class.

I'm not a big fan of dogmatic rules, other than the rule that says you 
should make your code as easy for somebody else to understand as possible.



More information about the Python-list mailing list