PEP 308: some candidate uses cases from live code

holger krekel pyth at devel.trillke.net
Mon Feb 10 22:43:44 CET 2003


Andrew Dalke wrote:
> 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?

good questions although your prename-cousin does have a point.
OTHOH nobody questioned that it's quite possible to mess up today's
"ternary op".  They are inherently messy IMO and so would
the bugs we encounter in a PEP-308-world be.  Let's stay binary
or even unary as much as possible. 

Maybe the voting should be accompanied by pleadings titled
"Andrew versus Andrew" :-)

    holger





More information about the Python-list mailing list