[Q] keeping *args and using it later

Tim Evans tre17 at student.canterbury.ac.nz
Sun Oct 24 19:32:22 EDT 1999


"Joao Neto" <vascog at uol.com.br> writes:

> Hi!
> 
> If I use a method to receive another method and its arguments, something
> like:
> 
> def keepCall( method, *args )
>    newTuple = (method, args)
>    myQueue.append( newTuple)
> 
> How can I call that method later? Just typing
> 
>    nextTuple = myQueue[0]
>    myQueue.remove(nextTuple)
> 
>    nextTuple[0](nextTuple[1])
> 
> doesn't seem to work...
> 
> Thanks in advance!
> 
> Joao

func, args = myQueue.pop(0) # requires 1.5.2 I think
apply(func, args)

--
Tim Evans





More information about the Python-list mailing list