PEP 308: A PEP Writer's Experience - PRO

Erno Kuusela erno-news at erno.iki.fi
Tue Feb 11 11:30:38 EST 2003


In article <yu99hebcrp9e.fsf at europa.research.att.com>, Andrew Koenig
<ark at research.att.com> writes:

| For example, look at this code from Python 2.2.2 Lib/unittest.py:

|         self.stream.writeln("Ran %d test%s in %.3fs" %
|                             (run, run == 1 and "" or "s", timeTaken))

isn't it a slippery slope to add "nice" alternatives for abuses like
the above, when there are currently much better ways of doing it?

i think the portion of cases that require conditional evaluation
of the arguments is sufficiently small that a function
that selects the second or third argument based on the first one
(+ current if/else for the minority) is sufficient.

  -- erno





More information about the Python-list mailing list