To understand the python module search path, I was trying to create a module by a name which is already available in the standard library. I have created a file 'math.py' in my current folder and it has a function definition 'factorial' which takes one argument. Now I want that when I import math module and invoke 'factorial' function, then my function is invoked and not the standard library one. All documents say that the search path held in 'sys.path' defines the order of search and it gives highest priority to the current directory.
But when I run my code I find that my math module is not getting loaded and my factorial function is not called. Python continues to load and execute the standard library definitions.
Where am I going wrong
Here is the file mymain.py
print "running...............>>"
import math
print math.factorial(5)
This is the file math.py (in the same directory as mymain.py)
print "math loaded"
def factorial(i) :
return i+10
And now I execute the command 'python mymain.py'