New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tab-completion of callables displays opening paren #58987
Comments
With tab completion enabled via rlcompleter and readline, tab-completion will assume anything that is callable (by callable(val)) is going to be called. For example, the below code defines a class "CCC" that is callable and has a static function. However, typing
>>> CC
and then pressing tab results in the following.
>>> CCC(
Note the extra parentheses. It would be nice if these weren't added if the object also has some other reasonable choices. However, I don't know what would be "reasonable" here. Somehow we'd have to detect whether a callable class has static methods, possibly via dir() or directly checking class.__dict__ but at this point I am not comfortable enough with python to suggest decent solutions. >>> class CCC:
... def __call__(self):
... print "call"
... @staticmethod
... def f(a):
... print "Static",a
...
>>>CC<TAB>
>>>CCC( |
This annoys me too, for all callable objects actually (e.g. I type "help(someprefix" then Tab then I have to delete the "(" before typing ")" and Enter), but I think it was a deliberate change. I may have the original bug report open in a browser tab at home, I’ll check. |
It's bpo-449227. |
FWIW, count me against the automatic brackets as well. Another way it gets in the road:
In bpo-5062, Carl thought there might be a switch to turn the behaviour off. Perhaps we could add some sort of configuration option. |
It changed by now to complete with "()" rather than just "(". |
That makes two characters to delete for people annoyed by the behaviour 🙂 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: