ANN: Dao Language v.0.9.6-beta is release!

Magnus Lycka lycka at carmen.se
Mon Dec 5 10:16:24 EST 2005


anthon at mnt.org wrote:
> Where does that misconception that 2-3 spaces for indenting makes
> things less readable come from? There was an article in Comm. of the
> ACM on research into readability back in 1984 or so, that indicated 2-4
> spaces has very similar readability and 8 spaces significantly less
> than that. IIRC they took care of personal preferences/what one was
> used to in the research. So disallowing tabs which could be set to 8
> spaces (positions?) does make sense to me.
> I switched from using 2 to using 4 spaces for Python recently, and the
> big pain was to deal with lines that no longer fitted in 80 columns :-(

Bigger indentation steps *are* more obvious, but on the other
hand, smaller indentation allows you to use more indentation
levels without using up all of your line width. (Using more than
80 chars per line is typically a bad idea.)

In general, I find that you rarely need so many indentation
levels in Python as in e.g. C or C++. I rarely run out of line
width in Python, even though I use 4 space indents and use fairly
long names. Remember that you can freely break lines within pairs
of (), [] and {}, and that adjacent string literals are concatenated.

If you try to squeeze something like...

self.logger.log(log_level, "Blaha bla bla bla bla"
    "at: %s:%i caused a %s with message\n%s\n" %
    (file_name, row, error, error_message))

...into one line, it doesn't matter what indentation depth you use...



More information about the Python-list mailing list