[Tutor] 'or' in assignment (not if statement)?

Walter Prins wprins at gmail.com
Sat Dec 11 03:38:15 CET 2010


Hi Steven

On 10 December 2010 03:50, Steven D'Aprano <steve at pearwood.info> wrote:

> Some languages (Pascal comes to mind) doesn't have short-circuit behaviour
> at all.
>

Don't mean to nit pick, but in my experience it really depends on the
compiler implementation and which version of Pascal you're talking about.
Certainly, Borland's Turbo Pascal had and later Object Pascal (today called
Delphi) has to this day short-circuit evaluation as default behaviour,
although you can turn this off via a compiler switch if you want.    (And as
an aside, according to wikipedia ISO Pascal actually also allows but does
not require support of short-circuit boolean evaluation.)  It really depends
on what your program does -- if your program contains functions with
side-effects (a bad idea, but if it does) then short-circuit evaluation will
probably break your code.  On the other hand, not having short-circuit
boolean expression evaluation can in most programming contexts be needlessly
inefficient.

Anyway, your general point is of course quite correct, so feel free to
ignore my ramblings...

Best,

Walter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101211/f820da9f/attachment.html>


More information about the Tutor mailing list