On Thu, 11 Dec 2008 22:44:20 +0800 Kermit Mei <[EMAIL PROTECTED]> wrote: > >>> ["%s=%s" % (k, v) for k, v in params.items()] > ['pwd=secret', 'database=master', 'uid=sa', 'server=mpilgrim'] > > I can't understand the second sentence because of the "for ... in". > I consider that the syntactics of "for" should be: > > for k,v in params.items():
I think you are binding ':' here too tightly to the 'for' construct in your mind. The for construct is "for <variable(s)> in <sequence>" which can be used as <block construct>:<statement(s)> in block constructs. The above is not a block construct but a list comprehension so it follows different rules. -- D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list