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

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Mon Oct 2 19:17:19 CEST 2006


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.

Bye,
bearophile




More information about the Python-list mailing list