How to coerce a list of vars into a new type?
Robert Kern
robert.kern at gmail.com
Mon Oct 2 14:18:25 EDT 2006
bearophileHUGS at lycos.com wrote:
> Me:
>>> def f(a, b, c):
>>> map(int, [a, b, c])
>>> ...code...
>
> Robert Kern:
>> That won't do anything since the names a, b, and c are never rebound.
>
> I think you are wrong. Try to give a "35.0" or a "hello" to that
> function f, and see the results.
>
> What it does is to: "verify that three parameters can all be converted
> into integers, but it doesn't modify the parameters themselves" as the
> OP asked.
Point.
--
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