Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76560

Re: Adapt bash readline operate-and-get-next

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
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; 'modify': 0.07; 'suppose': 0.07; 'executed': 0.09; 'executes': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'assume': 0.14; "(i'm": 0.16; 'cool.': 0.16; 'fetches': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'pressing': 0.16; 'sequence:': 0.16; 'statement.': 0.16; 'pushed': 0.16; ':-)': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'basically': 0.19; 'not,': 0.20; '>>>': 0.22; 'input': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'skip': 0.24; 'regardless': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'first,': 0.26; 'second': 0.26; 'gets': 0.27; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; 'lines': 0.31; 'subject:next': 0.31; 'guess': 0.33; 'could': 0.34; 'received:google.com': 0.35; 'next': 0.36; 'changing': 0.37; 'skip:o 20': 0.38; 'does': 0.39; 'sure': 0.39; 'even': 0.60; 'above,': 0.60; 'you.': 0.62; 'back': 0.62; "you've": 0.63; '(that': 0.65; 'line,': 0.68; 'press': 0.70; 'subject:get': 0.81; 'disappear': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=BZF1VDwIKSoy09gViCVAPFVVTMKjDvFtroqdFjySyCw=; b=YTer6y1rWQxZ2ENI+i1HS4rUskq9pFYmp6m8RSvPiyPECic7TDZN5SlnLL0p/7+S29 RfNrpqukz9PykaHonp2YVZEBpJeab0O6tuJS1NW1vBmadasbEA2RrD+/j4coLiIlSDix oeiKt8HYaeWz+P7sGb+vWffr3cpx8ArmT2vR4eHsPgSADoWqBuK5S9Z9zkwRqYlDXoyR 4BGScRvsNwI3iajF6G+HRMpCqOblRIORsRNBYHthawJSqZmqnIquFotmV7QzsO+D2OQ0 uU5vNpepeAA8fVb3b6qwTGjWfhw/p3GnX/u0SUu0luKAelTmMa7eqhbXKE6DPHcKLilR 4FEQ==
MIME-Version 1.0
X-Received by 10.50.164.202 with SMTP id ys10mr5466409igb.6.1408452345964; Tue, 19 Aug 2014 05:45:45 -0700 (PDT)
Sender skip.montanaro@gmail.com
In-Reply-To <87bnrgooli.fsf@nautilus.nautilus>
References <232acf45-096d-466a-aa75-06d8c378b128@googlegroups.com> <53cc376e$0$2898$e4fe514c@news.xs4all.nl> <53926733-5e65-482f-96bc-0171c6a93d59@googlegroups.com> <mailman.12102.1405904534.18130.python-list@python.org> <4882fd4d-b772-4ebb-8aaa-0c20be6051b6@googlegroups.com> <mailman.12108.1405910327.18130.python-list@python.org> <lqj806$52h$1@reader1.panix.com> <CAPTjJmr8q-nQvgiwY7eWp8zMMZDi-OdvmrOKs-xCs=M4O2jR5Q@mail.gmail.com> <mailman.12130.1405958264.18130.python-list@python.org> <53cd47fc$0$6574$c3e8da3$5496439d@news.astraweb.com> <87egwdiqfq.fsf_-_@nautilus.nautilus> <CANc-5Uy6GDtJO+PR2UtOiS2qM1yLzox7h4WQ4009NUfeR2oOcw@mail.gmail.com> <87bnrgooli.fsf@nautilus.nautilus>
Date Tue, 19 Aug 2014 07:45:45 -0500
X-Google-Sender-Auth ytRJBR2KgDPtBTaI-nsK6h1XSQk
Subject Re: Adapt bash readline operate-and-get-next
From Skip Montanaro <skip@pobox.com>
To Lele Gaifax <lele@metapensiero.it>
Content-Type text/plain; charset=UTF-8
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13145.1408452671.18130.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408452671 news.xs4all.nl 2922 [2001:888:2000:d::a6]:46192
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76560

Show key headers only | View raw


On Tue, Aug 19, 2014 at 3:44 AM, Lele Gaifax <lele@metapensiero.it> wrote:
>> Does your position in the history disappear if you
>> operate_and_get_next(), then modify the next recalled input line?
>
> Not sure what you mean with "disappear": basically o-a-g-n "accepts" the
> current line (that is, "executes" it, and this means it gets pushed at
> the top of history), regardless you edited or not, then fetches the
> following input line from the history and presents it to you.
>
> 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?

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. :-)

Skip

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-20 14:14 -0700
  Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-20 22:36 +0100
  Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2014-07-20 23:40 +0200
    Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-20 15:44 -0700
      Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Chris Angelico <rosuav@gmail.com> - 2014-07-21 11:02 +1000
        Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-20 19:06 -0700
          Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Tim Chase <python.list@tim.thechases.com> - 2014-07-20 21:30 -0500
          Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Chris Angelico <rosuav@gmail.com> - 2014-07-21 12:38 +1000
            Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Grant Edwards <invalid@invalid.invalid> - 2014-07-21 14:27 +0000
              Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Shiyao Ma <i@introo.me> - 2014-07-21 22:40 +0800
                Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Grant Edwards <invalid@invalid.invalid> - 2014-07-21 16:51 +0000
                Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Grant Edwards <invalid@invalid.invalid> - 2014-07-21 16:57 +0000
              Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Chris Angelico <rosuav@gmail.com> - 2014-07-22 00:48 +1000
              Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Chris Angelico <rosuav@gmail.com> - 2014-07-22 00:51 +1000
                Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Grant Edwards <invalid@invalid.invalid> - 2014-07-21 16:55 +0000
                Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Chris Angelico <rosuav@gmail.com> - 2014-07-22 03:56 +1000
              Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Monte Milanuk <memilanuk@invalid.com> - 2014-07-21 14:55 +0000
              Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-21 16:19 +0100
                Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Grant Edwards <invalid@invalid.invalid> - 2014-07-21 16:56 +0000
              Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Chris Angelico <rosuav@gmail.com> - 2014-07-22 01:27 +1000
              Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Lele Gaifax <lele@metapensiero.it> - 2014-07-21 17:57 +0200
                Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-21 17:03 +0000
                Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Lele Gaifax <lele@metapensiero.it> - 2014-07-21 19:40 +0200
                Adapt bash readline operate-and-get-next Lele Gaifax <lele@metapensiero.it> - 2014-08-18 20:49 +0200
                Re: Adapt bash readline operate-and-get-next Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-19 10:17 +1000
                Re: Adapt bash readline operate-and-get-next Chris Angelico <rosuav@gmail.com> - 2014-08-19 10:32 +1000
                Re: Adapt bash readline operate-and-get-next Lele Gaifax <lele@metapensiero.it> - 2014-08-19 10:49 +0200
                Re: Adapt bash readline operate-and-get-next Lele Gaifax <lele@metapensiero.it> - 2014-08-19 11:51 +0200
                Re: Adapt bash readline operate-and-get-next Skip Montanaro <skip@pobox.com> - 2014-08-18 14:06 -0500
                Re: Adapt bash readline operate-and-get-next Lele Gaifax <lele@metapensiero.it> - 2014-08-19 10:44 +0200
                Re: Adapt bash readline operate-and-get-next Skip Montanaro <skip@pobox.com> - 2014-08-19 07:45 -0500
                Re: Adapt bash readline operate-and-get-next Lele Gaifax <lele@metapensiero.it> - 2014-08-19 15:10 +0200
              Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Chris Angelico <rosuav@gmail.com> - 2014-07-22 02:05 +1000
              Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Terry Reedy <tjreedy@udel.edu> - 2014-07-21 15:16 -0400
            RE: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! "Coll-Barth, Michael" <Michael.Coll-Barth@VerizonWireless.com> - 2014-07-21 10:51 -0400
          Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-21 03:45 +0100
          Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Terry Reedy <tjreedy@udel.edu> - 2014-07-20 23:05 -0400
          Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Chris Angelico <rosuav@gmail.com> - 2014-07-21 13:09 +1000
          Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"! Martin S <shieldfire@gmail.com> - 2014-07-21 09:51 +0200
    Re: Tabbed IDLE (was PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"!) Tim Chase <python.list@tim.thechases.com> - 2014-07-20 19:56 -0500
    Re: Tabbed IDLE (was PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"!) Chris Angelico <rosuav@gmail.com> - 2014-07-21 11:04 +1000
    Re: Tabbed IDLE (was PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"!) Tim Chase <tim@thechases.com> - 2014-07-20 19:55 -0500
  Idle open file dialogs (was ...) Terry Reedy <tjreedy@udel.edu> - 2014-07-20 22:59 -0400

csiph-web