What does the Double Star operator mean in Python?

PythonServer Side ProgrammingProgramming

For numeric data types double asterisk (**) is defined as exponentiation operator

>>> a=10; b=2
>>> a**b
>>> a=1.5; b=2.5
>>> a**b
>>> a=3+2j
>>> b=3+5j
>>> a**b

In a function definition, argument with double asterisks as prefix helps in sending multiple keyword arguments to it from calling environment

>>> def function(**arg):
    for i in arg:
      print (i,arg[i])

>>> function(a=1, b=2, c=3, d=4)
a 1
b 2
c 3
d 4

Published on 06-Feb-2018 07:07:38