Arithmetic sequences in Python

Kent Johnson kent at kentsjohnson.com
Thu Jan 19 07:24:08 EST 2006


Paul Rubin wrote:
> aleax at mail.comcast.net (Alex Martelli) writes:
>>I see no credibly simple and readable alternative to {a:b, c:d}
>>dictionary display syntax, for example; dict(((a,b),(c,d))) just
>>wouldn't cut it, because of the "parentheses overload" (double
>>entendre intended).
> 
> 
> dict(a=b,c=d)
> 
> I don't really see why keyword arg names have to be identifiers
> either.  foo(3=4) can pass a **kwargs containing {3:4}.

The keywords need to be parseable; what would be the keyword form of
   { '3=4, 5=' : 6 }
or
   { '3=4); print "gotcha"; dict(6=' : 7 }
?

Kent



More information about the Python-list mailing list