Dynamic function execution

Fredrik Lundh fredrik at pythonware.com
Sun Nov 26 06:37:38 EST 2006


Cameron Laird wrote:

> ?  Or am I missing the point that a better example of what 
> Mr. Wu really wants is
> 
>   def func(seconds = None, minutes = None, hours = None):
>       print seconds
>       print minutes
>       print hours
> 
>   dimension = "minutes"
>   func(**{dimension: 30})

I assumed that the OP was looking for a mechanism that allowed him to 
use strings for parameter names, not that he wasn't able to replace a
literal with a variable once he knew what mechanism to use...

</F>




More information about the Python-list mailing list