PEP308: a call for usability studies (was Re: Update to PEP308: if-then-else expression)

Damien Morton newsgroups1 at bitfurnace.com
Thu Feb 13 14:56:33 EST 2003


I just tried out the useability tests on two designers. Both of these guys
are familiar with Javascript.

1)  a=1

    designer 1+2: ok


2)
    if a == 1:
        b = 2
    else:
        b = 3

    designer 1+2: ok


3)
    b = 2 if a==1 else 3

    designer 1: it seems like if you say it out loud it doesn't make sense
        [reading it out loud using 'otherwise' instead of 'else' made more
sense]

    designer 2: b = 2 (if a == 1) else b = 3...
        [not sure what the designer was trying to express by rewriting the
expression]

4)
    b = (if a==1: 2 else: 3)

    designer 1: a little convoluted too, but there's something about the
colons that makes sense to me

    designer 2: seems clear


5)
    b = (a == 1? 2, 3)

    designer 1: the most clear, but probably just because i know javascript

    designer 2: this is cleaner and easier to spot when scanning code...



There are 5 widely known and taught languages I know of that use the C
ternary operator form:

C, C++, Java, C#, Javascript

I would hazard a guess that just about any programmer who has learned a
programming language before coming to Python will have learned one of those
5 languages. I would also hazard a guess that anyone who learns Python as
their first programming language will likely also learn one of the 5 above
mentioned languages later in life.












More information about the Python-list mailing list