Anton Shishkov a écrit :
Hi, I can't figure out how can I change the variable type in function.
In C I could do that easily by changing pointer.
(snip)
Others already answered on this. Now, the real question is : why to you
want to do such a thing ?
Of one the most common use case for this idiom in C is to workaround the
lack of multiple return values, so your function returns an error code
*and* "sets" a value thru the pointer. This idiom makes no sense in
Python since we have exception handling. FWIW, other use case are
usually solved by tuple unpacking, ie:
def fun(a, b):
return a+b, a*b
sum_, prod = fun(5, 4.5)
HTH
--
http://mail.python.org/mailman/listinfo/python-list