Use comprehension rather than map.

This commit is contained in:
Ahmed Charles 2015-10-23 04:25:22 +00:00 committed by Griatch
parent 7645338218
commit 99f0fec7cf
2 changed files with 2 additions and 2 deletions

View file

@ -261,7 +261,7 @@ class CmdUnconnectedCreate(MuxCommand):
session.msg("Sorry, there is already a player with the name '%s'." % playername)
return
# Reserve playernames found in GUEST_LIST
if settings.GUEST_LIST and playername.lower() in map(str.lower, settings.GUEST_LIST):
if settings.GUEST_LIST and playername.lower() in (guest.lower() for guest in settings.GUEST_LIST):
string = "\n\r That name is reserved. Please choose another Playername."
session.msg(string)
return

View file

@ -595,7 +595,7 @@ class ANSIString(with_metaclass(ANSIMeta, unicode)):
char_indexes = kwargs.pop('char_indexes', None)
clean_string = kwargs.pop('clean_string', None)
# All True, or All False, not just one.
checks = map(lambda x: x is None, [code_indexes, char_indexes, clean_string])
checks = [x is None for x in [code_indexes, char_indexes, clean_string]]
if not len(set(checks)) == 1:
raise ValueError("You must specify code_indexes, char_indexes, "
"and clean_string together, or not at all.")