python-aware wdiff?

Ian Kelly ian.g.kelly at gmail.com
Mon Jul 14 22:59:14 CEST 2014


On Mon, Jul 14, 2014 at 2:01 PM, Terry Reedy <tjreedy at 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.



More information about the Python-list mailing list