Suggesting methods with similar names
Diez B. Roggisch
deetsNOSPAM at web.de
Wed Mar 30 15:51:11 EST 2005
bearophileHUGS at lycos.com wrote:
> I have a class Surface with many methods. Working in the interactive
> window I receive an error like this when I write the wrong method name:
>
>>>> table.addGlas()
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> AttributeError: 'Surface' object has no attribute 'addGlas'
>
> Is it possibile to make the object give a better answer: a short list
> of few method names similar to the one I've misspelled?
Have you heard of rlcompleter2? It gives you tab-completion on the repl.
While your idea looks nice at first glance, what I don't like about it that
it will make an object return always _something_ - and thus you don't catch
misspellings in non-interactive, or at least not where they actually happen
but when you try to work with the results.
--
Regards,
Diez B. Roggisch
More information about the Python-list
mailing list