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

Björn Lindström bkhl at stp.lingfil.uu.se
Mon Oct 2 13:42:19 EDT 2006


bearophilehugs at lycos.com:

> def f(a, b, c):
>     map(int, [a, b, c])
>     ...code...
>
> 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.

I would probably put that map in an assert statement, to make the
intention clearer.

-- 
Björn Lindström <bkhl at stp.lingfil.uu.se>
Student of computational linguistics, Uppsala University, Sweden



More information about the Python-list mailing list