cmck / python-tabulate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

benchmark output failure in python3

anarcat opened this issue · comments

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?