""" special.py looking at one of python's special variables, __name__ ... and showing a doctest (in double()) There are two ways to run this, which do different things : 1. Running python itself from the command prompt. $ python special.py __name__ is __main__ 2. After an "import", within an interactive python session $ python >>> from special import * >>> main() __name__ is special """ def double(x): """ return twice x >>> double(10) 20 """ return 2*x def main(): print(" __name__ is ", __name__) print(" double(3) is ", double(3)) def is_it_between(x): # another way to do things similar to "else" if x > 10: print("x is bigger than 10") return if x < 3: print("x is smaller 3") return if __name__ == '__main__': import doctest doctest.testmod() main()