PEP308: Yet another syntax proposal

Andrew Dalke adalke at mindspring.com
Mon Feb 10 15:52:36 EST 2003


Andrew Koenig:
> Yes -- as I've noted elsewhere in this discussion, Lib/unittest.py
> actually contains a (minor) bug because it uses and/or where it
> doesn't fit.  The code is on lines 618-619:
>
>         self.stream.writeln("Ran %d test%s in %.3fs" %
>                             (run, run == 1 and "" or "s", timeTaken))

And I've noted elsewhere (so no need to followup on this thread)
that from that snippet it appear that the person who wrote this
has more exprience in using other languages (hence the strange
use of 'writeln') than Python, so that this is perhaps not the best
indicator of an apropriate Python solution.

On the other hand, it suggests that an if/else expression would
make for fewer mistakes caused by people with experience in
if/else from other languages.

My other comments stand, so I am now convinced that a
true if/else short-circuiting operator is not needed (only about
once every 5,000 lines or so) while an iff()-like builtin function
is much more likely to be appropriate for most cases.

I am about +0.5 for iff() and about -0.7 for the if/else expression.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list