@@ -584,8 +584,7 @@ def _metavar_formatter(self, action, default_metavar):
584584if action .metavar is not None :
585585result = action .metavar
586586elif action .choices is not None :
587- choice_strs = [str (choice )for choice in action .choices ]
588- result = '{%s}' % ',' .join (choice_strs )
587+ result = '{%s}' % ',' .join (map (str ,action .choices ))
589588else :
590589result = default_metavar
591590
@@ -633,8 +632,7 @@ def _expand_help(self, action):
633632if hasattr (params [name ],'__name__' ):
634633params [name ]= params [name ].__name__
635634if params .get ('choices' )is not None :
636- choices_str = ', ' .join ([str (c )for c in params ['choices' ]])
637- params ['choices' ]= choices_str
635+ params ['choices' ]= ', ' .join (map (str ,params ['choices' ]))
638636return self ._get_help_string (action )% params
639637
640638def _iter_indented_subactions (self ,action ):
@@ -743,7 +741,7 @@ def _get_action_name(argument):
743741elif argument .dest not in (None ,SUPPRESS ):
744742return argument .dest
745743elif argument .choices :
746- return '{' + ',' .join (argument .choices )+ '}'
744+ return '{%s}' % ',' .join (map ( str , argument .choices ))
747745else :
748746return None
749747
@@ -2613,7 +2611,7 @@ def _check_value(self, action, value):
26132611# converted value must be one of the choices (if specified)
26142612if action .choices is not None and value not in action .choices :
26152613args = {'value' :value ,
2616- 'choices' :', ' .join (map (repr ,action .choices ))}
2614+ 'choices' :', ' .join (map (str ,action .choices ))}
26172615msg = _ ('invalid choice: %(value)r (choose from %(choices)s)' )
26182616raise ArgumentError (action ,msg % args )
26192617