g = dominoes.Game.new()
for _ in range(fixed_moves):
g.make_move(*g.valid_moves[0])
In the last line, what does the *
before object g
mean?
g = dominoes.Game.new()
for _ in range(fixed_moves):
g.make_move(*g.valid_moves[0])
In the last line, what does the *
before object g
mean?
Asterisks (*
) in arguments are used for unpacking.
For example:
def f(n, m):
pass
l = [2, 3]
f(*l)
This will unpack l
and will make the parameters n
and m
2
and 3
, respectively.