
December 23rd, 2012, 05:04 AM
|
 |
Contributing User
|
|
Join Date: Nov 2012
Location: Iran / France
|
|
|
I wonder, whether what you try to do could be useful, as there are already built-in functions (int(), float(); long(), str(), ...) available for converting to appropriate types
http://docs.python.org/2/library/functions.html
Even if you manage to write such a function, as I understand, each time based on the context in which the function is being used, it is up to you to provide manually, the corresponding casting function value as the second argument of your defined function. So I don't see any generalization that help avoiding rewriting the same code multiple times.
Regards,
Dariyoosh
|