D'Arcy J.M. Cain wrote:
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.
Yes, I see. Thanks you all.
--
http://mail.python.org/mailman/listinfo/python-list