[Python-ideas] except expression
Chris Angelico
rosuav at gmail.com
Mon Feb 17 16:06:48 CET 2014
On Tue, Feb 18, 2014 at 2:00 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> Guess what these evaluate to :-)
>
> x = lambda y: y, 2
> x = 2,
> x = 1, 2,
> x = {1:2,}
The first one is the only one that might be at all in question. The
others are straight-forward: a one-element tuple, a two-element tuple,
and a one-element dict. The last two are simply making use of the fact
that trailing commas are permitted, which is *extremely* handy in
avoiding code churn.
ChrisA
More information about the Python-ideas
mailing list