homepage

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.

Author wpettersson
Recipients wpettersson
Date 2012年05月11日.12:16:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1336738586.42.0.602618902889.issue14782@psf.upfronthosting.co.za>
In-reply-to
Content
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(
History
Date User Action Args
2012年05月11日 12:16:26wpetterssonsetrecipients: + wpettersson
2012年05月11日 12:16:26wpetterssonsetmessageid: <1336738586.42.0.602618902889.issue14782@psf.upfronthosting.co.za>
2012年05月11日 12:16:25wpetterssonlinkissue14782 messages
2012年05月11日 12:16:25wpetterssoncreate

AltStyle によって変換されたページ (->オリジナル) /