How to receive python's array in function -
how receive array (like numpy ones) function? let's array a = [[2],[3]]
, function f
. tuples works this:
def f((a ,b)): print * b f((2,3))
but how arrays?
def f(#here): print a*b f([[2],[3]])
tuple unpacking in function arguments has been removed python 3, suggest stop using it.
lists can unpacked tuples:
def f(arg): [[a], [b]] = arg return * b
or tuple:
((x,), (y,)) =
but use indexes:
return arg[0][0] * arg[1][0]
Comments
Post a Comment