"Usability, the Soul of Python"

Robert Fendt no.spam at local.local
Wed Mar 31 00:32:41 CEST 2010

And thus spake "Alf P. Steinbach" <alfps at start.no>
Tue, 30 Mar 2010 13:40:22 +0200:

> <quote>
>  From a usability standpoint, the braces go with the lines to print out the 
> stanza rather than the for statement or the code after, so the following is best:
> for(i = 99; i > 0; ++i)
>      {
>      printf("%d slabs of spam in my mail!\n", i);
>      printf("%d slabs of spam,\n", i);
>      printf("Send one to abuse and Just Hit Delete,\n");
>      printf("%d slabs of spam in my mail!\n\n", i + 1);
>      }
> </quote>

I liked this one even more:

One way of writing the same code in Python would be:

count = 99
while count > 0:
    print u'%d slabs of spam in my mail!' % count
    print u'%d slabs of spam,' % count
    print u'Send one to abuse and Just Hit Delete,'
    count += 1
    print u'%d slabs of spam in my mail!' % count
    print u''

The braces are gone, and with them the holy wars. Whatever brace
styles Python programmers may happen to use in languages with
braces, all the Python code looks the same, and while the major
brace styles illustrated above are a few of many ways the C code
could be laid out, there's only one real way to do it.

Has the fact changed that Python does not care about (1) how
many characaters you use for indentation, (1a) you can use tabs
OR spaces, (2) indentation does not have to be consistent across
a module, (3) not even across a file, (4) even in nested blocks
and (5) you can even switch from spaces to tabs and back in the
same file? So much for 'all the Python code looks the same'.

In general I do not really see what qualifies the author for an
article on Python's usability. On the same site one can also
find a lot of things e.g. on intelligent design and creationism,
and the 'The Case For Uncreative Web Design' in which the author
advocates 'uncreative' (in the sense of non-distracting) web
design while at the same time showcasing quite the opposite:
suffice it to say I found most essays rather difficult to read
from a technical point of view, to say nothing about the content.


More information about the Python-list mailing list