Fix so we clear or reinitialize various data structures before populating

(allows the same FancyGetopt object to be used multiple times with different
option tables).
This commit is contained in:
Greg Ward 2000-08-07 00:45:51 +00:00
parent f9d20c3786
commit 0fd2dd6db0

View file

@ -93,6 +93,7 @@ class FancyGetopt:
def _build_index (self):
self.option_index.clear()
for option in self.option_table:
self.option_index[option[0]] = option
@ -153,6 +154,10 @@ class FancyGetopt:
the option table. Called by 'getopt()' before it can do
anything worthwhile."""
self.long_opts = []
self.short_opts = []
self.short2long.clear()
for option in self.option_table:
try:
(long, short, help) = option