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

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -