How to coerce a list of vars into a new type?
Matthew Wilson
matt at tplus1.com
Mon Oct 2 10:53:10 EDT 2006
I want to verify that three parameters can all be converted into
integers, but I don't want to modify the parameters themselves.
This seems to work:
def f(a, b, c):
a, b, c = [int(x) for x in (a, b, c)]
Originally, I had a bunch of assert isinstance(a, int) statements at the
top of my code, but I decided that I would rather just check if the
parameters can be converted into integers.
The new a, b, and c are all different objects, with different id values.
Anyhow, this all seems like black magic to me. Can anyone explain what
is going on?
Is it as simple as call-by-value?
--
A better way of running series of SAS programs:
http://overlook.homelinux.net/wilsonwiki/SasAndMakefiles
More information about the Python-list
mailing list