List comprehension for testing **params

Joshua Landau joshua.landau.ws at gmail.com
Mon Nov 12 14:23:23 CET 2012


Just a few tricks you may have missed:

On 12 November 2012 10:48, Ulrich Eckhardt
<ulrich.eckhardt at dominolaser.com>wrote:

> Am 11.11.2012 23:24, schrieb Cantabile:

    if required.intersection(params.**keys()) != required:
>

if required.issubset(params):


>        missing = required - set(params.keys())
>

missing = required.difference(params)


>        raise Exception("missing arguments {}".format(
>                        ', '.join(missing)))



(untested)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121112/d03c28d3/attachment.html>


More information about the Python-list mailing list