
report at bugs
May 11, 2012, 5:16 AM
Post #1 of 1
(42 views)
Permalink
|
|
[issue14782] Tabcompletion of classes with static methods and __call__ has extra bracket
|
|
New submission from w.pettersson <william.pettersson [at] gmail>: 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( ---------- components: Library (Lib) messages: 160412 nosy: wpettersson priority: normal severity: normal status: open title: Tabcompletion of classes with static methods and __call__ has extra bracket type: behavior _______________________________________ Python tracker <report [at] bugs> <http://bugs.python.org/issue14782> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
|