newbie: prefix operator "**"
Jeff Epler
jepler at unpythonic.net
Wed Jan 21 10:59:59 EST 2004
On Wed, Jan 21, 2004 at 10:33:49AM -0500, Christian Jauvin wrote:
> Hello,
>
> I am playing with some classes in the Tkinter module
> to learn some GUI basics.
Take a look at the Tutorial, section 4.7.2. The ** prefix for an
argument means that it accepts arbitrary keyword arguments.
http://python.org/doc/tut/node6.html#SECTION006720000000000000000
Example:
def f(**kw):
print kw
>>> f(a=1, b=2)
{'a': 1, 'b': 2}
Tkinter uses this to pass the keyword arguments along to the next level,
eventually to the Tk command to create or configure a widget.
Jeff
More information about the Python-list
mailing list