PEP308: Yet another syntax proposal
holger krekel
pyth at devel.trillke.net
Mon Feb 10 15:11:40 EST 2003
Andrew Koenig wrote:
> holger> right. in which case learning about and/or (which you have to
> holger> anyway) often helps. Because of the "y is false" problem in
> holger> "x and y or z" there are some cases where it doesn't fit. Do
> holger> we have real code examples for them?
>
> 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))
I answered on one of the threads you posted it on.
Similar "mix-up" accidents might also happen with PEP-308-syntax.
IMO ternary operators generally lead to mixups. That's probably
because we all think so binary.
regards,
holger
--
The world is divided into 10 kinds of people. Those who
can count binary numbers and those who don't.
More information about the Python-list
mailing list