converting a string to a function parameter
pietrodcof at gmail.com
pietrodcof at gmail.com
Sun Jan 5 14:39:26 EST 2014
Il giorno venerdì 13 marzo 2009 08:52:39 UTC+1, koranthala ha scritto:
> Hi,
> Is it possible to convert a string to a function parameter?
> Ex:
> str = 'True, type=rect, sizes=[3, 4]'
> and I should be able to use it as:
> test(convert(str)) and the behaviour should be same as calling test
> with those values :
> i.e. test(True, type=rect, sizes=[3, 4])
>
> I tried eval, but it did not work. And any other mechanism I think
> turns out to be creating a full fledged python parser.
>
> Is there any mechanism with which we can do this straight away?
I need the exact opposite, what is the inverse function?
example: i pass to a function an argument
m=[654,54,65]
def function(m):
return takethenameof(m)
and it have to return to me 'm' not [654,54,65] or '[654,54,65]'
anybody can help?
i think that when one is talking about a function he have to talk also of the inverse function (also because google have problems searching about this...)
More information about the Python-list
mailing list