[Yum-devel] [PATCH] Change map(lambda ... => list comprehensions

Tim Lauridsen tim.lauridsen at googlemail.com
Mon Oct 12 14:50:51 UTC 2009


On 10/12/2009 04:16 PM, Seth Vidal wrote:
>
>
> On Mon, 12 Oct 2009, James Antill wrote:
>
>> ---
>> cli.py            |    4 ++--
>> yum/__init__.py   |   13 ++++++++-----
>> yum/depsolve.py   |    3 ++-
>> yum/packages.py   |    4 ++--
>> yum/rpmsack.py    |    2 +-
>> yum/sqlitesack.py |    6 +++---
>> yumcommands.py    |    2 +-
>> 7 files changed, 19 insertions(+), 15 deletions(-)
>
>
> NACK: I don't think this should go in pre- 3.2.25 - it doesn't fix any 
> bugs and it just introduces too many places for typo errors.
>
>
>
>>
>> diff --git a/cli.py b/cli.py
>> index 332be99..b6bff1c 100644
>> --- a/cli.py
>> +++ b/cli.py
>> @@ -535,7 +535,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
>>         """ If install argument doesn't match with case, tell the 
>> user. """
>>         matches = self.doPackageLists(patterns=[arg], ignore_case=True)
>>         matches = matches.installed + matches.available
>> -        matches = set(map(lambda x: x.name, matches))
>> +        matches = set((x.name for x in matches))
Should this not be set([x.name for x in matches])
>>         if matches:
>>             msg = self.fmtKeyValFill(_('  * Maybe you meant: '),
>>                                      ", ".join(matches))
>> @@ -565,7 +565,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
>>                 _('Package(s) %s%s%s available, but not installed.'),
>>                                     hibeg, arg, hiend)
>>             return
>> -        matches = set(map(lambda x: x.name, matches.installed))
>> +        matches = set((x.name for x in matches.installed))
and this too

Tim


More information about the Yum-devel mailing list