#!/usr/bin/env python # module mymod2.py def cube(n): return n ** 3 # when 'import'ed, __name__ is 'mymod2' # when executed, __name__ is '__main__' if __name__ == '__main__': if cube(15) != 3375: print "Error, cube(15) is not correct"
In reply to Re^2: Dual personality: Module and script
by japhy
in thread Dual personality: Module and script
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |