Hi
Inside a function i get a two arguments, say arg1 and arg2, how can i convert 
arg2 to same type as arg1 ?
I dont know type of arg1 or arg2 for that matter, I just want to convert arg2 
to type of arg1 if possible and handle the exception if raised.
Also:
>>> int('2')
2
>>> float('2.0')
2.0
>>> coerce(2,2.0)
(2.0,2.0)
but coerce('2',2) fails.If int('2') equals 2, why should it fail ?


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to