Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #63215

Re: converting a string to a function parameter

Newsgroups comp.lang.python
Date 2014-01-05 11:39 -0800
References <aaf29677-db0b-4749-84b1-ce965e0f545e@v5g2000prm.googlegroups.com>
Message-ID <ef4ee1e8-e247-4fda-ae5f-439dd9742a75@googlegroups.com> (permalink)
Subject Re: converting a string to a function parameter
From pietrodcof@gmail.com

Show all headers | View raw


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...)

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: converting a string to a function parameter pietrodcof@gmail.com - 2014-01-05 11:39 -0800
  Re: converting a string to a function parameter Ned Batchelder <ned@nedbatchelder.com> - 2014-01-05 14:58 -0500
  Re: converting a string to a function parameter Gary Herron <gary.herron@islandtraining.com> - 2014-01-05 12:09 -0800

csiph-web