cmck / python-tabulate

MIT License
5 stars 1 forks source link

benchmark output failure in python3 #3

Open anarcat opened 4 years ago

anarcat commented 4 years ago

It seems python3 doesn't like that codecs hack:

$ python3 benchmark.py 
b'===========================  ==========  ===========\nTable formatter                time, \xce\xbcs    rel. time\n===========================  ==========  ===========\ncsv to StringIO                    14.7          1.0\njoin with tabs and newlines        20.3          1.4\nasciitable (0.8.0)                338.4         23.0\ntabulate (0.8.3)                  725.3         49.3\nterminaltables (3.1.0)            806.5         54.8\nPrettyTable (0.7.2)              1364.5         92.7\ntexttable (1.6.2)                2044.0        138.8\n===========================  ==========  ==========='

if i just remove it, the output looks okay again:

diff --git i/benchmark.py w/benchmark.py
index 05254c1..42d62f8 100644
--- i/benchmark.py
+++ w/benchmark.py
@@ -108,11 +108,7 @@ def benchmark(n):
                               [u"Table formatter", u"time, μs", u"rel. time"],
                               u"rst", floatfmt=".1f")

-    import platform
-    if platform.platform().startswith("Windows"):
-        print(table)
-    else:
-        print(codecs.encode(table, "utf-8"))
+    print(table)

 if __name__ == "__main__":

why was that done in the first place?