About reading Python code

sturlamolden sturlamolden at yahoo.no
Mon Mar 17 20:57:00 EDT 2008


On 17 Mar, 04:54, WaterWalk <toolmas... at 163.com> wrote:

> So I'm curious how to read code effectively. I agree that python code
> is clear, but when it becomes long, reading it can still be a hard
> work.

First, I recommend that you write readable code! Don't use Python as
if you're entering the obfuscated C contest.

Two particularly important points:

* If you find yourself thinking this module is too long, that's
probably what it is. Half a page of code per module is fine. Two pages
of code per module can be too much.

* Comments are always helpful to the reader.

Second, I recommend getting a good IDE. E.g. pick one of:

* Microsoft Visual Studio (commercial)
* Eclipse with PyDev and CDT (free)
* SPE (free)
* ActiveState Komodo IDE (commercial)




More information about the Python-list mailing list