(PEP-308) Python's Conditional Selection Operators

Stephen Horne intentionally at blank.co.uk
Sat Feb 15 01:56:14 EST 2003


On Fri, 14 Feb 2003 20:50:10 -0800, Erik Max Francis <max at alcyone.com>
wrote:

>Stephen Horne wrote:
>
>> But lisp has never been a defining standard for all programming
>> languages.
>
>Of course it hasn't.  But your declaring something as not being
>"standard" does not make it so.  There _is_ no "standard," there's just
>what different languages do.

A 'de facto standard' doesn't require a comittee. No-one mentioned ISO
or ANSI or the like. Most languages follow the same convention. That
is all it takes to make it a de facto standard. As 'de facto standard'
was the only sensible interpretation of what Terry said, IMO there was
nothing wrong with his use of the word 'standard'.

Perhaps 'convention' might have been a better word. The term
'standard' seems to imply that everything else is wrong. But then
again, 'conventional' somehow suggests an old, dated concept that
needs replacing. I doubt that Terry intended either judgement.


It's actually interesting to consider why returning a boolean result
is the convention - considering that a generalisation used in lisp
made enough impact to have been replicated decades later in python, it
may seem odd at first glance that it hasn't been used in many more
languages.

The explanation, though, is simple enough. In statically typed
languages, the generalised 'and' and 'or' simply wouldn't work. The
left and right arguments often have different types so they need to be
able to return a dynamically typed result. That one issue prevents the
method being applied effectively in conventional languages. 

However, statically typed languages don't reign in the way they once
did. As dynamically typed languages become more popular, and as (I
hope) functional languages get more and more recognition outside of
academia, it will be interesting to see if the current de facto
standard gets replaced.

I have my doubts - the use of the selective logic operators are, for
my money, too different from the everyday English use of the words -
though of course that doesn't quite match the boolean algebra use
either. Given the option, I suspect most people would prefer an
explicit conditional expression syntax - but then again... well, we'll
see.

-- 
steve at ninereeds dot fsnet dot co dot uk




More information about the Python-list mailing list