M
Matthew Wilson
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?
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?