On Fri, Dec 12, 2008 at 12:44 AM, Kermit Mei <[EMAIL PROTECTED]> wrote: > 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(): > ...... > > But there's no a colon here, why it can work?
It's called a list comprehension. The "for x in y" construct becomes an expression. Simple example: Build a list of integers divisible by 3: >>> [x for x in xrange(10) if not x % 3] [0, 3, 6, 9] cheers James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list