To understand Python's optparse
Question: Thank you for quack in pointing out the off-by-one!

The following code is my first attempt in writing code with Optparse.

**How can you fix the following bug in getting the help by Optparse?**

    
    
    #!/usr/bin/env python
    import sys
    import os
    from optparse import OptionParser
    
    
    e = sys.argv[1]
    b = sys.argv[2]
    no = sys.argv[3]
    
    def set_figu(figu):
            sum = 777
            return sum
    
    
    def main():
            usage = "Usage: negative_bin_base.py <eksponentti> <siirre> <figu>"
            parser = OptionParser(usage)
            parser.add_option("-h", "--help", dest="help",
                            help="get synopsis of parameters")
            # print the output of the work-horse
            print set_figu(no)
    
            (options, args) = parser.parse_args()
            if len(args) < 4:
                    parser.error("incorrect number of arguments")
            if options.informative:
                    print "reading %s..." % options.help
    
    if __name__ == "__main__":
            main()
    

**Example of wrong output with correct number of parameters**

    
    
    python negative_bin_base.py 13 13 332
    Traceback (most recent call last):
      File "negative_bin_base.py", line 37, in <module>
        main()
      File "negative_bin_base.py", line 26, in main
        help="get synopsis of parameters")
      File "/usr/lib/python2.6/optparse.py", line 1020, in add_option
        self._check_conflict(option)
      File "/usr/lib/python2.6/optparse.py", line 995, in _check_conflict
        option)
    optparse.OptionConflictError: option -h/--help: conflicting option string(s): -h, --help
    


Answer: Constructor for `class optparse.OptionParser(...)` has optional named
parameter 'add_help_option', which defaults to 'True'. You will have to
explicitly reject default help option and message, if you want to provide your
own.  
  
`parser = OptionParser(usage, add_help_option=False)`

