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


Groups > comp.lang.python > #32079

Re: while expression feature proposal

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'elif': 0.04; '*args,': 0.07; 'subject:while': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; '"m"': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message- id:@cskk.homeip.net': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:edu.au': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'simpson': 0.16; 'subject:expression': 0.16; 'wrote:': 0.17; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'paul': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'writes:': 0.29; 'class': 0.29; 'becomes': 0.30; 'stuff': 0.30; 'handle': 0.33; 'but': 0.36; 'received:au': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'mark': 0.38; 'sure': 0.38; 'content-disposition:inline': 0.60; 'results': 0.65; 'construct': 0.84
Date Thu, 25 Oct 2012 09:58:11 +1100
From Cameron Simpson <cs@zip.com.au>
To Paul Rubin <no.email@nospam.invalid>
Subject Re: while expression feature proposal
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <7x625zo5su.fsf@ruckus.brouhaha.com>
User-Agent Mutt/1.5.21 (2010-09-15)
References <7x625zo5su.fsf@ruckus.brouhaha.com>
Cc 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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2805.1351119493.27098.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351119493 news.xs4all.nl 6955 [2001:888:2000:d::a6]:60288
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32079

Show key headers only | View raw


On 24Oct2012 15:37, Paul Rubin <no.email@nospam.invalid> wrote:
| Cameron Simpson <cs@zip.com.au> writes:
| >   if re_FUNKYPATTERN.match(test_string) as m:
| >     do stuff with the results of the match, using "m"
| 
|   class memo:
|      def __call__(f, *args, **kw):
|         self.result = f(*args, **kw)
| 
|   m = memo()
|   if result(re_FUNKYPATTERN.match, test_string):
|        do stuff with the results of the match,
|        using "m.result"
| 
| then
| 
|       if re_CONSTRUCT1.match(line) as m:
|         ... handle construct 1 ...
|       elif re_CONSTRUCT2.match(line) as m:
|         ... handle construct 2 ...
|       elif re_CONSTRUCT3.match(line) as m:
| 
| becomes
| 
|    if m(re_CONSTRUCT1.match, line):
|      .. handle construct 1 ...
|    elif m(re_CONSTRUCT2.match, line):
|      .. handle construct 2 ...

Cute. Not sure I like it, but cute:-)
-- 
Cameron Simpson <cs@zip.com.au>

If you do not read the paper, you are uninformed. If you do read the
paper, you are misinformed. - Mark Twain

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


Thread

Re: while expression feature proposal Cameron Simpson <cs@zip.com.au> - 2012-10-25 09:26 +1100
  Re: while expression feature proposal Paul Rubin <no.email@nospam.invalid> - 2012-10-24 15:37 -0700
    Re: while expression feature proposal Paul Rubin <no.email@nospam.invalid> - 2012-10-24 15:47 -0700
    Re: while expression feature proposal Cameron Simpson <cs@zip.com.au> - 2012-10-25 09:58 +1100
  Re: while expression feature proposal Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-10-25 11:44 +0200
  Re: while expression feature proposal Grant Edwards <invalid@invalid.invalid> - 2012-10-25 14:15 +0000
    Re: while expression feature proposal Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-10-25 18:15 +0200

csiph-web