[docs] Inaccurate description of HtmlDiff.make_table, Python 3.1.5

rail shafigulin rail.shafigulin at gmail.com
Mon Nov 5 16:17:26 CET 2012


That's what I meant by inaccurate description. Documentation for make_table
says that the differences will be highlighted,
http://docs.python.org/release/3.1.5/library/difflib.html#difflib.HtmlDiff.make_table,
while the output shows that it isn't. Either documentation needs to be
fixed not to say that differences will be highlighted or the code needs to
be fixed to generate appropriate highlighting.

Thanks.


On Mon, Nov 5, 2012 at 10:04 AM, Andrew Svetlov <andrew.svetlov at gmail.com>wrote:

> Well, use HtmlDiff().make_file(s1, s2) method or provide css for
> make_table by yourself.
>
> On Mon, Nov 5, 2012 at 4:50 PM, rail shafigulin
> <rail.shafigulin at gmail.com> wrote:
> > I tried running the code you have given using Python 3.1.5 and Python
> 3.3.0.
> > The result is always the same and I don't see any highlighting. Here is
> what
> > I did on the Windows command line:
> >
> > C:\Documents and Settings\shafigulinr>python -c "from difflib import *;
> s1 =
> > ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']; s2 = ['python\n', 'eggy\n',
> > 'hamster\n', 'guido\n']; print(HtmlDiff().make_table(s1, s2))" >
> diff.html
> >
> > I'm also attaching the result file.
> >
> > I'm running Python 3.1.5/3.3.0 on a Windows XP Pro Version 2002, SP 3,
> > Google Chrome browser, Version 22.0.1229.94 m
> >
> >
> > On Fri, Nov 2, 2012 at 4:46 PM, Andrew Svetlov <andrew.svetlov at gmail.com
> >
> > wrote:
> >>
> >> Perhaps we have some misunderstanding.
> >>
> >> I tried:
> >>
> >> >>> from difflib import *
> >> >>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
> >> >>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
> >> >>> d.make_table(s1, s2)
> >> ... LONG ENOUGH OUTPUT
> >>
> >> when I've opened that output in browser the differences was definitely
> >> highlighted.
> >>
> >> I've tried it on 3.2, 3.1 is open for security bugs only for now BTW.
> >> Please inform me how to reproduce your problem.
> >> Also please keep in mind: 3.1 in security-only stage, if your issue has
> >> been fixed in 3.2 we'll do nothing to backport fix into 3.1
> >>
> >> Thanks.
> >>
> >>
> >> On Fri, Nov 2, 2012 at 8:47 PM, rail shafigulin
> >> <rail.shafigulin at gmail.com> wrote:
> >>>
> >>> I can't see any highlighting. I'm attaching diff.html which I generated
> >>> using the script provided here,
> >>>
> http://docs.python.org/release/3.1.5/library/difflib.html#a-command-line-interface-to-difflib
> >>> . In the script I changed make_file to make_table to demonstrate the
> effect.
> >>> I'm also attaching two text files I used for diff generation.
> >>>
> >>> I'm running Python 3.1.5 on a Windows XP Pro Version 2002, SP 3.
> >>>
> >>> Thanks.
> >>>
> >>>
> >>> On Thu, Nov 1, 2012 at 6:34 AM, Andrew Svetlov <
> andrew.svetlov at gmail.com>
> >>> wrote:
> >>>>
> >>>> It works, at least from my understanding of «highlighting».
> >>>>
> >>>>
> >>>> On Tue, Oct 30, 2012 at 9:16 PM, rail shafigulin
> >>>> <rail.shafigulin at gmail.com> wrote:
> >>>>>
> >>>>> The description of HtmlDiff.make_table is inaccurate,
> >>>>>
> http://docs.python.org/release/3.1.5/library/difflib.html#difflib.HtmlDiff.make_table
> >>>>> It says the following
> >>>>>
> >>>>> "Compares fromlines and tolines (lists of strings) and returns a
> string
> >>>>> which is a complete HTML table showing line by line differences with
> >>>>> inter-line and intra-line changes highlighted."
> >>>>>
> >>>>> However non of the rows in the tables are highlighted.
> >>>>>
> >>>>> There are two possible fixes for this.
> >>>>>
> >>>>> 1. The documentation is incorrect in describing what should happen
> when
> >>>>> this method is called. Instead of what is says right now it should
> say that
> >>>>> the table is generated without showing any differences.
> >>>>> 2. The code does not reflect the documentation, i.e. make_table
> should
> >>>>> generate the html string correctly.
> >>>>>
> >>>>> I'm running Python 3.1.5 on a Windows Xp Pro Version 2002, SP 3.
> >>>>>
> >>>>> _______________________________________________
> >>>>> docs mailing list
> >>>>> docs at python.org
> >>>>> http://mail.python.org/mailman/listinfo/docs
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Thanks,
> >>>> Andrew Svetlov
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Thanks,
> >> Andrew Svetlov
> >
> >
>
>
>
> --
> Thanks,
> Andrew Svetlov
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20121105/09fb777a/attachment-0001.html>


More information about the docs mailing list