[libcxx-commits] [PATCH] D84040: [libcxx][lit] Fix incorrect lambda capture in hasLocale checks
Alexander Richardson via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 17 09:49:41 PDT 2020
arichardson marked an inline comment as done.
arichardson added inline comments.
================
Comment at: libcxx/utils/libcxx/test/features.py:110
+ # end of the loop. Use functools.partial instead:
+ features.append(Feature(name='locale.{}'.format(locale),
+ when=functools.partial(hasLocale, locales=alts)))
----------------
ldionne wrote:
> I think you can also use:
>
> ```
> lambda cfg, alts=alts: any(hasLocale(cfg, alt) for alt in alts)
> ```
>
> I think it's more idiomatic in Python, and it seems easier to understand.
I find functools.partial slightly more obvious than adding a default argument. But I don't really mind either way. Will change to the default argument solution and keep any().
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84040/new/
https://reviews.llvm.org/D84040
More information about the libcxx-commits
mailing list