[issue10087] HTML calendar is broken

Alexander Belopolsky report at bugs.python.org
Mon Nov 22 16:27:47 CET 2010

Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Mon, Nov 22, 2010 at 9:48 AM, Chris Lambacher <report at bugs.python.org> wrote:
> I don't understand what you mean by "elides the line breaks in output".

It is actually not that bad:

$ ./python.exe -m calendar -t html| wc -l
$ python2.7 -m calendar -t html| wc -l

At first, I thought that html was printed one line at a time, but now
I realize that it is prepared in-memory and printed in one shot.  The
extra '\n' in python2.7 is probably a bug in 2.7.

I think this is a reasonable approach.    Just a few comments on the patch:

1. Unit tests needed.
2. It may be appropriate to add a warning to the documentation stating
that using -e option may mess up the terminal.
3.   In the following snippet, p is an unconditional shortcut to
sys.stdout.buffer.write.  I would just call it "write"

         optdict = dict(encoding=encoding, css=options.css)
+        p = sys.stdout.buffer.write

4.  While white space consistency with 2.7 is not very important, the
following should be fixed, IMO:

$ ./python.exe -m calendar -e ascii| wc -l
$ ./python.exe -m calendar| wc -l

5. I wonder how ./python.exe -m calendar -e ascii will look on
Windows.  I don't think cmd window is smart about displaying unix line


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list