Suggesting methods with similar names

Raymond Hettinger vze4rx4y at verizon.net
Wed Mar 30 12:55:32 EST 2005


[Bearophile]
> 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?

[Bearophile]
> Thank you, __getattr__ does what I need :-)
> A smart help can be designed easely...

The idea is a winner.  When you're done, consider posting the result as an ASPN
cookbook recipe.


Raymond Hettinger





More information about the Python-list mailing list