cpython icon indicating copy to clipboard operation
cpython copied to clipboard

rlcompleter add "(" to callables feature

Open rnd0110 opened this issue 25 years ago • 13 comments

BPO 449227
Nosy @birkenfeld, @facundobatista, @pitrou
Files
  • rlcompleter.py: rlcompleter.py which does it for Python2.5
  • rlcompleter.diff: patch to rlcompleter which does almost as described
  • rlcompleter2.6.diff: rlcompleter adds "(" to callables in 2.6 and documentation
  • 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:

    assignee = 'https://github.com/facundobatista'
    closed_at = <Date 2008-07-02.16:53:46.832>
    created_at = <Date 2001-08-08.18:04:32.000>
    labels = ['easy', 'type-feature', 'library']
    title = 'rlcompleter add "(" to callables feature'
    updated_at = <Date 2008-07-17.20:42:35.016>
    user = 'https://bugs.python.org/rnd0110'
    

    bugs.python.org fields:

    activity = <Date 2008-07-17.20:42:35.016>
    actor = 'pitrou'
    assignee = 'facundobatista'
    closed = True
    closed_date = <Date 2008-07-02.16:53:46.832>
    closer = 'facundobatista'
    components = ['Library (Lib)']
    creation = <Date 2001-08-08.18:04:32.000>
    creator = 'rnd0110'
    dependencies = []
    files = ['8188', '8189', '10721']
    hgrepos = []
    issue_num = 449227
    keywords = ['patch', 'easy']
    message_count = 13.0
    messages = ['53224', '53225', '53226', '53227', '53228', '68547', '68646', '68695', '68696', '68697', '68698', '69107', '69906']
    nosy_count = 6.0
    nosy_names = ['georg.brandl', 'facundobatista', 'rnd0110', 'pitrou', 'gpolo', 'dieresys']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue449227'
    versions = ['Python 2.6']
    

    rnd0110 avatar Aug 08 '01 18:08 rnd0110

    I use rlcompleter extensively in interactive Python mode. I think it could be cool if callable objects were added "(" when completed. This way it will be much faster to program, without looking-up __doc__. For example:

    >>> f.fil<TAB>
    will give:
    >>> f.fileno(_
    ("_" is to mark cursor position)
    and:
    
    >>> f.so<TAB>
    will (as before) give:
    >>> f.softspace _
    

    rnd0110 avatar Aug 08 '01 18:08 rnd0110

    Logged In: YES user_id=1188172

    Any comments on this one? Sounds reasonable to me.

    birkenfeld avatar Jul 17 '05 13:07 birkenfeld

    Logged In: YES user_id=287815

    Perhaps one needs to propose a patch. Otherwise it will not advance...

    rnd0110 avatar Nov 09 '06 06:11 rnd0110

    Logged In: YES user_id=287815

    Wow! The patch is here! Why isn't is accepted into the distribution???

    rnd0110 avatar Nov 09 '06 07:11 rnd0110

    Logged In: YES user_id=287815

    One more illustration:

    >>> f = open("myfile", "w")
    >>> f.
    f.__class__(         f.__repr__(          f.next(
    f.__delattr__(       f.__setattr__(       f.read(
    f.__doc__            f.__str__(           f.readinto(
    f.__enter__(         f.close(             f.readline(
    f.__exit__(          f.closed             f.readlines(
    f.__getattribute__(  f.encoding           f.seek(
    f.__hash__(          f.fileno(            f.softspace
    f.__init__(          f.flush(             f.tell(
    f.__iter__(          f.isatty(            f.truncate(
    f.__new__(           f.mode               f.write(
    f.__reduce__(        f.name               f.writelines(
    f.__reduce_ex__(     f.newlines           f.xreadlines(
    >>> f.
    
    • nice to remember which attributes are methods and which aren't.

    rnd0110 avatar Nov 09 '06 07:11 rnd0110

    Here is a new patch against 2.6.

    dieresys avatar Jun 21 '08 21:06 dieresys

    I have also updated the rlcompleter documentation. Here is the complete patch. rlcompleterAndDoc2.6.diff

    dieresys avatar Jun 23 '08 20:06 dieresys

    Thanks for the patch!

    However, I do not understand if it ever gets included into Python or remains always for those who find it? (I do not believe this small change is somehow PEPable, but how it gets included then?)

    rnd0110 avatar Jun 24 '08 17:06 rnd0110

    This is nearly good. But I have some notes: you don't need to import operator here, just use the built-in callable; stick to <80 columns; leave a space after a comma.

    gpolo avatar Jun 24 '08 17:06 gpolo

    Guilherme, Thanks a lot for taking some time to review my patch. Here is a new version.

    Please take another look and tell me what do you think about it. Thanks again

    dieresys avatar Jun 24 '08 18:06 dieresys

    On Tue, Jun 24, 2008 at 3:42 PM, Manuel Muradás <[email protected]> wrote:

    Manuel Muradás <[email protected]> added the comment:

    Guilherme, Thanks a lot for taking some time to review my patch. Here is a new version.

    Please take another look and tell me what do you think about it. Thanks again

    That is good to be applied now.

    Added file: http://bugs.python.org/file10721/rlcompleter2.6.diff


    Python tracker <[email protected]> <http://bugs.python.org/issue449227>


    gpolo avatar Jun 24 '08 18:06 gpolo

    Fixed in 64664.

    Thank you everybody!

    facundobatista avatar Jul 02 '08 16:07 facundobatista

    This issue caused a regression in bpo-3396.

    pitrou avatar Jul 17 '08 20:07 pitrou