Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; ':-(': 0.07; 'lesser': 0.07; 'option,': 0.07; 'subject:How': 0.09; 'here?': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'missed': 0.15; 'obviously': 0.15; '23,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'suggestion.': 0.16; 'wrote:': 0.16; 'say,': 0.18; '>>>': 0.20; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'explicit': 0.22; 'am,': 0.23; '2015': 0.23; 'module': 0.23; 'header:In-Reply-To:1': 0.24; 'installed': 0.26; 'chris': 0.26; 'skip:" 20': 0.26; 'message- id:@mail.gmail.com': 0.28; 'went': 0.28; "i'm": 0.29; 'readline': 0.29; 'no,': 0.29; 'there.': 0.30; 'call.': 0.31; "can't": 0.32; 'especially': 0.32; 'though,': 0.32; "d'aprano": 0.33; 'steven': 0.33; 'subject:?': 0.34; 'received:google.com': 0.34; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'missing': 0.37; 'tue,': 0.38; 'version': 0.38; 'say': 0.38; 'someone': 0.38; 'does': 0.39; 'seem': 0.39; 'subject:the': 0.40; 'back': 0.61; 'even': 0.61; 'avoid': 0.61; 'offer': 0.65; 'better.': 0.66; 'course.': 0.67; 'superior': 0.67; 'obvious': 0.72; 'subject:get': 0.81; '11:02': 0.84; 'chrisa': 0.84; "it'd": 0.84; 'to:none': 0.90 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=WyR7oveeI8nbkbuHtORDitBSOoHoo/4rapZFpgoz9VI=; b=l6/3Vel1qnLUzpfL2L2Bg/eN3Qxcv2Rx9EWt5YQ7U9kFbIeZC9ZyPx3NcXLPlD1liu 8Db4B97cmcQsFOl6TOv4sHujB91DtiM+vet6FAEEofukAu9kR1zkerY+CHi/WuZXG4qw qkVTFD/A5R9Z5BbkE5AHODwVDXA5hWIPx5cQisMiSYzG/gQ7r0KDH+Q/kwwsZTcfkYOW /LygGWejSyU+Vk2W7YJUMWLlgJuxK7beI0IRiRsoL1VC4qBwQHI2fL8ajzezgINyUO1D qdpWU2LeifbQD16yU0NY5ugaPKlWzUf7jKXd0l0QyL/TyxRCDtNTFvqLp9flvbRL6URG ld8w== MIME-Version: 1.0 X-Received: by 10.43.0.67 with SMTP id nl3mr28589945icb.59.1435024953146; Mon, 22 Jun 2015 19:02:33 -0700 (PDT) In-Reply-To: <5588b957$0$1664$c3e8da3$5496439d@news.astraweb.com> References: <5588b01b$0$1649$c3e8da3$5496439d@news.astraweb.com> <5588b957$0$1664$c3e8da3$5496439d@news.astraweb.com> Date: Tue, 23 Jun 2015 12:02:33 +1000 Subject: Re: How do I get the currently installed tab completion function? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1435024955 news.xs4all.nl 2845 [2001:888:2000:d::a6]:56368 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4904 X-Received-Body-CRC: 975997612 Path: csiph.com!usenet.pasdenom.info!news.stben.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:93027 On Tue, Jun 23, 2015 at 11:41 AM, Steven D'Aprano wrote: > On Tue, 23 Jun 2015 11:23 am, Chris Angelico wrote: > >> On Tue, Jun 23, 2015 at 11:02 AM, Steven D'Aprano >> wrote: >>> How do I get the currently installed completer? >>> >>> Solutions for any version of Python acceptable, but if they work all the >>> way back to 2.4 or older, even better. >> >> Whether there's a way to avoid the whole try/finally I can't say, but >> I just went looking for the obvious "readline.get_completer()", and it >> does seem to be there. Is there something I'm missing here? > > No, but there's obviously something *I'm* missing. > > I don't know how I missed that :-( > > It's especially embarrassing because it is available all the way back to > version 2.4, which is exactly what I need. > > > Sorry for the noise. That's still only the lesser option, of course. Better would be a way to say raw_input("prompt? ", completer=filename_completer) but that's not an option, so it'd have to be an explicit readline.something() call. I can't find any way to actually ask the readline module to read a line, though, but given that my experience with that module is effectively zip, someone else may well be able to offer a superior suggestion. ChrisA