This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年05月11日 12:16 by wpettersson, last changed 2022年04月11日 14:57 by admin.
| Messages (4) | |||
|---|---|---|---|
| msg160412 - (view) | Author: w.pettersson (wpettersson) | Date: 2012年05月11日 12:16 | |
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( |
|||
| msg160420 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年05月11日 16:41 | |
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.
|
|||
| msg160633 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年05月14日 16:11 | |
It's issue 449227. |
|||
| msg265472 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年05月13日 12:51 | |
FWIW, count me against the automatic brackets as well. Another way it gets in the road: >>> class C(object(. . . In Issue 5062, Carl thought there might be a switch to turn the behaviour off. Perhaps we could add some sort of configuration option. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:30 | admin | set | github: 58987 |
| 2016年05月13日 12:51:25 | martin.panter | set | messages: + msg265472 |
| 2015年02月11日 10:56:25 | martin.panter | set | nosy:
+ martin.panter |
| 2012年05月14日 16:11:38 | r.david.murray | set | nosy:
+ rnd0110, dieresys, facundobatista, pitrou, gpolo, r.david.murray, georg.brandl messages: + msg160633 |
| 2012年05月11日 16:41:32 | eric.araujo | set | title: Tab-completion of classes displays opening paren -> Tab-completion of callables displays opening paren |
| 2012年05月11日 16:41:09 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg160420 title: Tabcompletion of classes with static methods and __call__ has extra bracket -> Tab-completion of classes displays opening paren |
| 2012年05月11日 12:16:25 | wpettersson | create | |