Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'assignment': 0.07; 'suppose': 0.07; 'executed': 0.09; 'executes': 0.09; 'received:151': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'assume': 0.14; "(i'm": 0.16; 'cool.': 0.16; 'emanuele': 0.16; 'pressing': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sequence:': 0.16; 'statement.': 0.16; ':-)': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'input': 0.22; 'aug': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'skip': 0.24; 'question': 0.24; 'first,': 0.26; 'second': 0.26; 'header:X-Complaints-To:1': 0.27; 'am,': 0.29; 'statement': 0.30; 'lines': 0.31; 'subject:next': 0.31; 'writes:': 0.31; 'another': 0.32; 'guess': 0.33; 'could': 0.34; 'changing': 0.37; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'above,': 0.60; 'che': 0.60; 'back': 0.62; "you've": 0.63; 'line,': 0.68; 'press': 0.70; 'subject:get': 0.81; 'quando': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Lele Gaifax Subject: Re: Adapt bash readline operate-and-get-next Date: Tue, 19 Aug 2014 15:10:54 +0200 Organization: Nautilus Entertainments References: <232acf45-096d-466a-aa75-06d8c378b128@googlegroups.com> <53cc376e$0$2898$e4fe514c@news.xs4all.nl> <53926733-5e65-482f-96bc-0171c6a93d59@googlegroups.com> <4882fd4d-b772-4ebb-8aaa-0c20be6051b6@googlegroups.com> <53cd47fc$0$6574$c3e8da3$5496439d@news.astraweb.com> <87egwdiqfq.fsf_-_@nautilus.nautilus> <87bnrgooli.fsf@nautilus.nautilus> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 151.62.28.218 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.93 (gnu/linux) Cancel-Lock: sha1:at1ZLxZuXhZ68BeZ0zWNrGtiCaI= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408453868 news.xs4all.nl 2875 [2001:888:2000:d::a6]:54435 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76562 Skip Montanaro writes: > On Tue, Aug 19, 2014 at 3:44 AM, Lele Gaifax wrote: >> Given these lines in the history: >> >> >>> a=10 >> >>> a-=1 >> >>> print(a) >> 9 > > Suppose you have the above, as you indicated. Ctl-P your way back to > the a=10 line. Press Ctl-O. It executes that assignment and fills the > input buffer with "a-=1". Instead of just pressing Ctl-O, type a "1" > first, changing the input buffer to "a-=11". *Now* press Ctl-O. I > assume it executes that statement. You've edited the line, however. > Does it present you with the print statement or not? Yes, it presents the print statement. Another Ctrl-O will present "a-=11" again, and so on. > I guess I could have answered my own question using bash: > > firefly% a=10 > firefly% a='a' > firefly% echo $a > a > firefly% a=10 > firefly% a='b' > firefly% echo $a > b > > The second batch of three lines were executed from history with this > key sequence: > > Ctl-P Ctl-P Ctl-P Ctl-O DEL DEL b ' Ctl-O RET > > That's pretty cool. Even if I never live to see it in Python (I'm > still using 2.7), I will definitely start using it in bash. :-) Yes, it's very handy indeed! ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. lele@metapensiero.it | -- Fortunato Depero, 1929.