[Tutor] dict vs several variables?

Sander Sweers sander.sweers at gmail.com
Fri Feb 17 14:33:37 CET 2012


On 17 February 2012 14:04, leam hall <leamhall at gmail.com> wrote:
> My concern with variables is that they have to be passed in specific
> order to the function, and they may have to have their type set
> multiple times so that you can perform the right functions on them. In
> a dict you could set it on insert and not have to worry about it.

There is **kwargs which is behaves like a dict. This is very powerful
but comes with the drawback that you have to make sure you get all the
variables you need for your function to work properly.

I found [1] that is a decent explanation of how these work. Other
might have better explanations.

Greets
Sander
[1] http://basicpython.com/understanding-arguments-args-and-kwargs-in-python/


More information about the Tutor mailing list