PEP 308: some candidate uses cases from live code

Andrew Dalke adalke at mindspring.com
Mon Feb 10 15:44:37 EST 2003


Andrew Koenig:
> Here's an example from the Python 2.2.2 distribution, Lib/unittest.py,
> lines 618-619:
>
>         self.stream.writeln("Ran %d test%s in %.3fs" %
>                             (run, run == 1 and "" or "s", timeTaken))
>
> Need I say more?

Care to make any comments about the use of the non-standard
and Pascal-like "writeln" instead of using the much more standard
"write" with a "\n" at the end of the string?

Are other parts of the code written as if by someone with
more experience in some language other than Python?  Could that
experience have cause them to want a "?: by any means" rather
than using a more traditional approach?

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list