PEP 308: Rejection of C ?? T || F

Steven Taschuk staschuk at telusplanet.net
Thu Feb 13 06:45:14 EST 2003


(This is an editorial comment about the PEP's rejection of ?? ||,
not an argument one way or another about its merits.)

Quoth PEP 308 (rev 1.17):

    Raymond Hettinger proposed a variant that removes the
    arbitrariness [of ?: and ?!]:

            <condition> ?? <expression1> || <expression2>

    The ?? and || are not arbitrary as they strongly suggest testing
    and alternation.  [...]

Although ?? suggests testing (and surely this is why ? is used
here in C syntax), I do not feel that || suggests alternation,
except to readers familiar with C and its kin.  To readers without
prior exposure to such languages, "C ?? T || F" is imho as
mysterious as "C ? T : F" or "C ? T ! F" or "C ? T tiger F".

Since weirdness-except-for-C-programmers is given earlier in the
PEP as one reason to reject ?:, it would be imho more consistent
to make the same comment for ?? ||.

(As far as I can see, the only things that suggest alternation in
Python are 'or' and 'else', whence the current idiom and certain
existing proposals.)

-- 
Steven Taschuk           | Aral: "Confusion to the enemy, boy."
staschuk at telusplanet.net | Mark: "Turn-about is fair play, sir."
                         | (_Mirror Dance_, Lois McMaster Bujold)





More information about the Python-list mailing list