As the commenters have said, you can easily tell which one is being used just by looking at the most recent import statement. However, in case you get worried/confused, you can also directly check the module from which a function or class originates using Python's handy built-in reflection features.
For example, the following Python statement:
print(array.__module__)
will print out the string 'numpy.core.multiarray' if array was imported from the numpy package, or the string 'array' if it was imported from the array package.
If x.__module__ fails, explore alternatives via dir(x)
@ShadowRanger raises the good point that some Python objects don't have the __module__ property. In particular, if you run just import array, then array is a module and the print(array.__module__) call will fail. In these kinds of situations you can always discover what reflection information is actually available via the dir() function.
dir() is easily my favorite feature of Python. For any Python object x, dir(x) prints out the complete list of the attributes of x. For example, given that you just ran import array, executing dir(array) would then print out:
['ArrayType',
'__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__spec__',
'_array_reconstructor',
'array',
'typecodes']
Which shows that even though the array module lacks __module__, if does have other reflection information available such as __name__ and __file__.
print(type(math_stuff))... But you are using numpy array, since you've imported it from numpy. If you've also imported a module/function/class/object earlier with a same name from another library. The last import will override others.arrayname in Python. You canimportthearraymodule, but if you do that, you're explicitly creating the conflict (which is won by whoever took the name last). The code you provide doesn't show any indication that you didimport arrayorfrom array import array, so the answer is there is no conflict, because there is only one thing namedarrayin the code shown.import numpy as np, rather thanfrom numpy import stuff. That way you can writenp,array,np.empty, etc., which is a pretty good balance—a lot more concise thannumpy.empty, but no risk of colliding with other things namedempty.importing them from somewhere are the built-in functions and built-in constants. Aside from those specific things, everything else comes from imports.