I was thinking more in this direction: d = dict() d[action in not None and 'action'] = action d[minval > 0 and 'minval'] = minval ... del d[False]
There are few things I do not particularly like about this (assigning to dict, even when value is discarded later, or necessity of the del d[False]), but I guess it is as expressive as it could be and I could imagine using it in my app easily. If needed one can even define another key instead of False.
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/3IQ7GYOYKSSGKSWOGCFABF2KGHNY4PSY/ Code of Conduct: http://python.org/psf/codeofconduct/
