On Sat, Nov 3, 2018 at 3:03 PM MRAB python@mrabarnett.plus.com wrote:
Yes, that is a horrible spelling for:
{fnmatch.filter(names, p) for p in patterns}
But it has the advantage that it works. :-)
Indeed! Excellent point :-). I definitely should not post untested code from my tablet.
This is still slightly less horrible, but I recognize it's starting to border on horrible:
{n for p in patterns for n in fnmatch.filter(names, p)}
This seems worse:
set(chain(*(fnmatch.filter(names, p) for p in patterns)))