John O'Hagan wrote:
How to call a function with the right arguments without knowing in advance
which function? For example:
import random
def f1():
pass
def f2(foo):
pass
def f3(foo, bar):
pass
foo=random.choice((1,2,3))
bar=random.choice((1,2,3))
myfunc=random.choice((f1, f2,
John O'Hagan wrote:
> How to call a function with the right arguments without knowing in advance
> which function? For example:
>
> import random
>
> def f1():
> pass
>
> def f2(foo):
> pass
>
> def f3(foo, bar):
> pass
>
> foo=random.choice((1,2,3))
> bar=random.choice((1,2,3))
>
John O'Hagan a écrit :
How to call a function with the right arguments without knowing in advance
which function?
(snip)
For most use case I can think of, I can only second Steven and Chris -
if your functions are interchangeable then they should have a same API.
Now there's at least one u
On Sun, Sep 26, 2010 at 8:41 PM, John O'Hagan wrote:
> How to call a function with the right arguments without knowing in advance
> which function? For example:
>
> import random
>
> def f1():
> pass
>
> def f2(foo):
> pass
>
> def f3(foo, bar):
> pass
>
> foo=random.choice((1,2,3))
> bar
On Mon, 27 Sep 2010 03:41:13 +, John O'Hagan wrote:
> How to call a function with the right arguments without knowing in
> advance which function? For example:
>
> import random
>
> def f1():
> pass
>
> def f2(foo):
> pass
>
> def f3(foo, bar):
> pass
>
> foo=random.choice((1
How to call a function with the right arguments without knowing in advance
which function? For example:
import random
def f1():
pass
def f2(foo):
pass
def f3(foo, bar):
pass
foo=random.choice((1,2,3))
bar=random.choice((1,2,3))
myfunc=random.choice((f1, f2, f3))
How to call myfu