Python how remove the name of the parent object from function names
Question: I have a .py file with my own functions, which I run on ipython on several
machines. The problem is that in some platforms I can call functions like
sin(), size(), plot() without the prefix of the parent class name and on other
platforms I need to write the full path: numpy.sin(), ndarray.size(),
pyplot.plot(). 1) What are the rules that determine when the full path is used
and when I can use the short form? 2) Can I manually set a function to its
short form?


Answer: Take a look at the definition of the `import` statement. There are two forms:

    
    
    import math
    math.sin(1)
    

Second form is:

    
    
    from math import sin
    sin(1)
    

Note that since modules are also objects, you can also store `math.sin` in the
first case in a local variable:

    
    
    import math
    sin = math.sin
    sin(1)
    

