Problem of Readability of Python

John Nagle nagle at animats.com
Sun Oct 7 17:30:57 EDT 2007


Licheng Fang wrote:
> Python is supposed to be readable, but after programming in Python for
> a while I find my Python programs can be more obfuscated than their C/C
> ++ counterparts sometimes. Part of the reason is that with
> heterogeneous lists/tuples at hand, I tend to stuff many things into
> the list and *assume* a structure of the list or tuple, instead of
> declaring them explicitly as one will do with C structs. 

    Comments might help.

    It's common to use tuples that way, but slightly bad form to
use lists that way.

    Of course, you can create a class and use "slots" to bind
the positions at compile time, so you don't pay for a dictionary
lookup on every feature.

    (Someday I need to overhaul BeautifulSoup to use "slots".
That might speed it up.)

				John Nagle



More information about the Python-list mailing list