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


Groups > comp.lang.python > #80384

Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle.

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:code': 0.07; 'test,': 0.07; 'parameter': 0.09; 'try:': 0.09; 'valueerror:': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'def': 0.12; 'col': 0.16; 'subject: \n ': 0.16; 'subject:search': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'direction': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'url:python': 0.33; 'fri,': 0.33; 'subject:the': 0.34; 'except': 0.35; 'test': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'skip:j 20': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'nov': 0.38; 'url:mail': 0.40; 'break': 0.61; 'to:addr:gmail.com': 0.65; 'subject:this': 0.83; 'joel': 0.91
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:to :cc:content-type; bh=5vvXzyXgR6I2ixlufu9TpBvQGsKYlV/XRv7RKo1PjwI=; b=Mw9zo7+nxgkihAcEuaS7RLBwZbzphm2ZDvBCAb+pU9ZQKhVqdmNMSEIAG9wBfnmVKP n1IOzDlrYQLBoelkn1uIR1wGCeoRdUVa4UHR4JVWaD4oZRNYZM4WjCR1n5GaRHAJKiS5 yW1+MYbC3iS975aMd/GcJ8aXKY7HQKhZR1NBlyG32CR+IWwfTTqULLKlG7+W9MF5ceAj iSB1zlvyI44OweSF4evzkUllMaBEQWpn5upN6p3OnhMbXMUpXXUjRIcbqTNjqh8Z5mvC 7sAz0EfYvuij0rpDB9tvIyj9AdAusvyfAtMcFWhzy6NzWlHlEysjnFge1qY+Him3lfj/ smCw==
MIME-Version 1.0
X-Received by 10.229.79.132 with SMTP id p4mr21464049qck.14.1415395117741; Fri, 07 Nov 2014 13:18:37 -0800 (PST)
In-Reply-To <m3i9lp$8fp$1@dont-email.me>
References <m3i9lp$8fp$1@dont-email.me>
Date Fri, 7 Nov 2014 16:18:37 -0500
Subject Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle.
From Joel Goldstick <joel.goldstick@gmail.com>
To Veek M <vek.m1234@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc "python-list@python.org" <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.15576.1415395125.18130.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415395125 news.xs4all.nl 2843 [2001:888:2000:d::a6]:46113
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80384

Show key headers only | View raw


On Fri, Nov 7, 2014 at 5:16 AM, Veek M <vek.m1234@gmail.com> wrote:
>     def jump_to_blockD(self):
>         end = len(self.b)
>         row, col = self.w.cursor
>         while row <= end:
>             try:
>                 new_col = self.b[row].index('def')
>                 self.w.cursor = row, new_col
>                 break
>             except ValueError:
>                 pass
>             row += 1
>
>     def jump_to_blockU(self):
>         end = 0
>         row, col = self.w.cursor
>         while row >= end:
>             try:
>                 new_col = self.b[row].rindex('def')
>                 self.w.cursor = row, new_col
>                 break
>             except ValueError:
>                 pass
>             row -= 1
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list

add a direction parameter to the call, and test direction to change
the while test, and row increment/decrement

-- 
Joel Goldstick
http://joelgoldstick.com

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


Thread

How do i reduce this to a single function - the code is largely similar, just a direction of search toggle. Veek M <vek.m1234@gmail.com> - 2014-11-07 16:46 +0630
  Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle. Joel Goldstick <joel.goldstick@gmail.com> - 2014-11-07 16:18 -0500
  Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle. Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-07 22:22 +0000
  Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle. Chris Angelico <rosuav@gmail.com> - 2014-11-08 09:31 +1100
  Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle. Veek M <vek.m1234@gmail.com> - 2014-11-07 21:22 +0630
    Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle. Ned Batchelder <ned@nedbatchelder.com> - 2014-11-08 07:56 -0500
      Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle. Veek M <vek.m1234@gmail.com> - 2014-11-09 15:15 +0630
  Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle. Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-07 15:18 +0000

csiph-web