Not logged in
Log in now
Create an account
Subscribe to LWN
Recent Features
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
PostgreSQL 9.3 beta: Federated databases and more
LWN.net Weekly Edition for May 9, 2013
-- quote: "foo %s bar %s, %s, %s, %s, %s" % (foo, bar, map(lambda x: baz(x), [1, 2, 3, 4])) --
You could use list concatenation (+) to do something like
"foo %s bar %s, %s, %s, %s, %s" % tuple([foo, bar] + map(lambda x: baz(x), [1, 2, 3, 4]))
... which is slightly uglified by the "%" operator not accepting a list (hence the "tuple" call). But yeah, it would be handy to be able to use the argument list syntax in other places.
Still, 15 lines? :-)
Copyright © 2013, Eklektix, Inc. Comments and public postings are copyrighted by their creators. Linux is a registered trademark of Linus Torvalds