[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2016-05-13 Thread Martin Panter
Changes by Martin Panter : -- components: +Library (Lib) -Documentation, Extension Modules ___ Python tracker ___ ___ Python-bugs-list

[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2016-05-13 Thread Martin Panter
Martin Panter added the comment: Issue 14782 is open for complaints about the opening brackets. I think this report was mainly about attributes that fail the hasattr() test. In Issue 25590 we were conservative and only fixed it in 3.6+. -- nosy: +martin.panter resolution: -> duplicate

[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2014-06-26 Thread Mark Lawrence
Mark Lawrence added the comment: Patched code produces identical output to unpatched code. This doesn't really surprise me as word is reused within the for loop. -- nosy: +BreamoreBoy ___ Python tracker __

[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2009-01-26 Thread Gabriel Genellina
Gabriel Genellina added the comment: The current behaviour is actually a requested feature: see #449227 I see your point, it may be annoying sometimes -- but calling a method is far more common than just getting a reference to it, so I think the current behaviour is fine (I'm talking about th

[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2009-01-26 Thread Carl Johnson
Carl Johnson added the comment: Ah, I see. It does a dir(obj) then tests things to see which are callable and while it is at that, it removes the names that don't really exist according to getattr. Actually, can we go back to the Python 2.5 behavior? I really hate those auto-added parentheses.

[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2009-01-26 Thread Gabriel Genellina
Gabriel Genellina added the comment: The check is made to decide whether the attribute is a method or not (because methods get a "(" appended) -- for names that fail to exist, one could just omit the "(" and include the name anyway. rlcompleter does nothing special with __dir__, it always use

[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2009-01-26 Thread Carl Johnson
Carl Johnson added the comment: I think that checking to see which things really exist with getattr/hasattr made sense back in the days before the __dir__, since in those days the real API for an object could diverge wildly from what was reported by dir(object), but nowadays, if someone goes to

[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2009-01-26 Thread Gabriel Genellina
Gabriel Genellina added the comment: This is what rlcompleter does; it uses dir() to find out what names to return. Or do you mean that it should not iterate along __bases__ because this has already been done by dir()? ___ Python tracker

[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2009-01-26 Thread Carl Johnson
Carl Johnson added the comment: It seems to me that it isn't tab completion's place to out think the __dir__ method. A) Because the documentation doesn't tell you that it does (although you are warned that it may call some stuff) and B) because if someone set up a __dir__ method, they probably a

[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2009-01-26 Thread Gabriel Genellina
Gabriel Genellina added the comment: This is not a bug in rlcompleter; __dir__ is returning bogus items, and rlcompleter checks whether there exist actually an attribute with such name. Defining __getattr__ (or __getattribute__) and a matching __dir__ works fine: >>> class B(object): ...

[issue5062] Rlcompleter.Completer does not use __dir__ magic method

2009-01-25 Thread Carl Johnson
New submission from Carl Johnson : The documentation at http://docs.python.org/library/rlcompleter.html claims that Completer.complete(text, state)¶ Return the state*th completion for *text. If called for text that doesn’t include a period character ('.'), it will complete from names cur