Timeline for Extract function argument from string
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 20, 2020 at 9:12 | history | edited | Community Bot |
Commonmark migration
|
|
| Nov 13, 2017 at 11:33 | comment | added | clemens | Did you see my edit and my comment? What do you mean with your last sentence? | |
| Nov 13, 2017 at 11:29 | comment | added | Anass Elidrissi |
@macmoonshine Thank you for the answer, except that I don't want ` object ` to be a string. To clarify: Let's say I have mystring = '[ (1,1), (2,2), (3,3) ]' , I want to call foo([ (1,1), (2,2), (3,3) ]) . There is the possibility to use exec('foo('+mystring+')' ) , but if foo had many arguments or the list inside mystring was used frequently, that wouldn't be quite efficient, and the exec is quite annoying with the return .
|
|
| Nov 13, 2017 at 11:27 | comment | added | clemens |
I've updated my post. If you use the content of mystring multiple times, you should parse it once with myvalue = eval(mystring), and use myvalue as parameter.
|
|
| Nov 13, 2017 at 11:25 | history | edited | clemens | CC BY-SA 3.0 |
added 166 characters in body
|
| Nov 13, 2017 at 7:16 | history | edited | clemens | CC BY-SA 3.0 |
use variable instead of constant string
|
| Nov 13, 2017 at 7:16 | comment | added | clemens |
My code looks up for variable named mystring. The reason for that is, that you could use a variable instead of a string literal. See my edit.
|
|
| Nov 13, 2017 at 7:08 | comment | added | Jithin Pavithran |
How is this different from foo(mystring)? Yes it is, if there is some other mystring residing in a scope closer to foo().
|
|
| Nov 13, 2017 at 6:24 | history | answered | clemens | CC BY-SA 3.0 |