PEP 308: some candidate uses cases from live code
Andrew Koenig
ark at research.att.com
Mon Feb 10 17:40:44 EST 2003
Steve> However, it clearly introduces new precedence problems into the
Steve> syntax: how do I know you meant
Steve> self.stream.writeln("Ran %d test%s in %.3fs" %
Steve> (run, (if run==1: "" else: "s"), timeTaken)
Steve> and not (apart from the run-time error it would produce)
Steve> self.stream.writeln("Ran %d test%s in %.3fs" %
Steve> (run, if run==1: "" else: ("s", timeTaken))
Steve> Methinks anything that allows colons inside expressions will be
Steve> tough for us to read.
I'm not introducing any new precedence problems.
You know which of the alternatives above I mean in the same way you know that
foo(lambda x, y: x, y)
means
foo((lambda x, y: x), y)
and not
foo(lambda x, y: (x, y))
You can like or dislike the existing rules for colons inside expressions,
but I'm not proposing to change them.
--
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark
More information about the Python-list
mailing list