Daniel Keep, el 18 de abril a las 19:08 me escribiste: > > So I have created this, that I actually use in a large Graph class of mine > > that has many methods: > > http://code.activestate.com/recipes/409000/ > > Such class can be used from the interactive shell too, to play with graphs > > in an interactive way, modify them, plot them, etc. > > Often you may not remember the name of a method you need, or you may > > mistype it. In such situation __getattr__ is being called. It collects > > the class method names, removed the useless ones, and performs > > a similarity search between the given wrong method name and the > > strings in that list. Then returns the 4-5 most similar ones, each one > > followed by their docstring, that shows the function signature and the > > purpose of the method. So you can usually find the method you were > > looking for, and use it. This is useful both when using such Graph > > class from the command line and when you are writing code without an > > IDE that helps you finding method names. That Python code of mine > > becomes doable in D too (using for example my very fast approximate > > string distance. This is a case where you don't need the list of > > changes, but just the distance number. So superdan can rest in peace). > > > > Bye, > > bearophile > > There's an interesting idea... > > Instead of "No member 'foo'", you could have "No member 'foo'; did you > mean 'far' or 'fur'?"
Git[1] added that feature for Git commands recently and even when it's not really *that* useful, is a nice feature =) Maybe something like "candidates are: ..." following by each method and file location (to empower IDEs) can be done. I mean, the DMD frontend could do that, not opDot(Exp), of course ;) -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- Software is like sex: it's better when it's free. -- Linus Torvalds