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

Madhusudan.C.S madhusudancs at gmail.com
Sun Jan 11 22:22:47 CET 2009


  I am sorry all I am not here to just blame Python. This is just an
introspection of whether
what I believe is right. Being a devotee of Python from past 2 years I
have been writing only
small apps and singing praises about Python where ever I go. I now got
a chance to read
Django's code for some reason. I have now strongly started feeling if
Python really follows its
"Readability Counts" philosophy. For example,

    class A:
    a = 10
    b = "Madhu"

    def somemethod(self, arg1):
        self.c = 20.22
        d = "some local variable"
        # do something
        ....
    ...
    def somemethod2 (self, arg2):
        self.c = "Changed the variable"
        # do something 2
        ...

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. Its obviously not
possible to remember what
instance variable was defined where, when reading some substantial
amount of code and where
it was manipulated for that matter. It becomes so very frustrating
even when reading a Class's
code with just 6-8 methods and not more than 100-150 lines of code.

I am interested in knowing if I am reading this kind of code in the
wrong way mostly because
of C++/Java hangover since most other languages follow the same
approach as them? If there
is a Pythonic way reading this code for better readability? What made
Python developers to
adopt this strange strategy keeping "Readibility Counts" in mind?

-- Python Rocks!
   Madhusudan.C.S



More information about the Python-list mailing list