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


Groups > comp.lang.python > #74436

Re: python-aware wdiff?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'repository': 0.05; 'diff': 0.07; 'important,': 0.07; 'indicated': 0.07; 'latter': 0.09; '2.7': 0.14; "'-'": 0.16; 'deletions': 0.16; 'differs': 0.16; 'insertions': 0.16; 'reedy': 0.16; 'tokenize': 0.16; 'subject:python': 0.16; 'files.': 0.16; 'wrote:': 0.18; 'example': 0.22; 'mon,': 0.24; 'versions': 0.24; 'script': 0.25; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'probably': 0.32; 'skip:m 30': 0.32; 'minimal': 0.33; 'could': 0.34; 'something': 0.35; 'received:google.com': 0.35; '14,': 0.36; 'shows': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'though,': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'within': 0.65; 'jul': 0.74; '3.4': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=WSIpsziuzHKdHHAb/Hff23ZVCfO+G7KNk7ftgFvy3Vg=; b=xV2GvLdFG4Oef0+ULkYf92FfN8G/G0bM/djIVHIj+5WOYMrPeEbGBfGFyWdFrovq2Q T8GJtwvX/tfaJgrjEp5fXT8JOobih8xJ3YoKbBgoVC3LdeLcMLqYkVTPzhTfpspbglhB dCe6GCSToWTo8RaLbE96o6YyVk3zbdw7SL4HudeQ9fW8mhaMRvhC5NrIb7qEN5Kfr70J Nb39pmgToRBf6cvDPsGyVOiiMlzycbCcbn0HHM9Xvn7h+2fND0AluuwDUP3HQGDMXt1O ueKzjV+qvbfp2k37Ip/wpix3vXfyUIblwC5eOtsxdt/Vr0yx5Mo9d6+I5FsK50xE4IQh W+UQ==
X-Received by 10.68.69.109 with SMTP id d13mr2832116pbu.111.1405371594345; Mon, 14 Jul 2014 13:59:54 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <lq1d0d$5ep$1@ger.gmane.org>
References <D72E3D69-9015-44C2-8374-CF6CD57F501D@panix.com> <lq1d0d$5ep$1@ger.gmane.org>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Mon, 14 Jul 2014 14:59:14 -0600
Subject Re: python-aware wdiff?
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.11809.1405371597.18130.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1405371597 news.xs4all.nl 2952 [2001:888:2000:d::a6]:52969
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74436

Show key headers only | View raw


On Mon, Jul 14, 2014 at 2:01 PM, Terry Reedy <tjreedy@udel.edu> wrote:
> The under-known difflib.differ shows within line differences.
> Your example would look like:
>
> -    if not metar.is_in_temp_range_f(...):
> ?           ^^^^^
> +    if not info.is_in_temp_range_f
> ?           ^^^^
>
> Deletions and insertions are indicated with '-' and '+'.
> I use this routinely, when backporting patches, in a script that differs the
> 2.7 and 3.4 versions of repository files.

That will produce a minimal diff though, not a syntax-aware diff. If
the latter is important, something could probably be cooked up using
tokenize and difflib. Not sure how much work that would be.

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


Thread

Re: python-aware wdiff? Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-14 14:59 -0600

csiph-web