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

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


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...

Bye,
bearophile




More information about the Python-list mailing list