my Python program can be launched with a range of different options (or subcommands) like:
$ myProgram doSomething
$ myProgram doSomethingElse
$ myProgram no
There is the module optcomplete which allows you to write the completion for bash autocompletion in your python program. This is very useful in combination with optparse. You only define your arguments once, add the following to your .bashrc
complete -F _optcomplete
and all your options will be autocompleted.