How to coerce a list of vars into a new type?

Robert Kern robert.kern at gmail.com
Mon Oct 2 13:03:29 EDT 2006


bearophileHUGS at lycos.com wrote:
> Matthew Wilson wrote:
>> I want to verify that three parameters can all be converted into
>> integers, but I don't want to modify the parameters themselves.
> 
> To do what you need you can try this:
> 
> def f(a, b, c):
>     map(int, [a, b, c])
>     ...code...

That won't do anything since the names a, b, and c are never rebound.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list