summaryrefslogtreecommitdiff
path: root/cherrypy/py3util.py
diff options
context:
space:
mode:
authorLakin Wecker <none@none>2009-06-01 16:43:59 +0000
committerLakin Wecker <none@none>2009-06-01 16:43:59 +0000
commitbcac4e137da9675a5ba2ba4dfe0404288749e33a (patch)
tree9640ef6ef03106e218e9623e852e4c4f5fd42f8e /cherrypy/py3util.py
parent03f15ebb2a21e24a2a7458b9022ce05e89137fa4 (diff)
downloadcherrypy-git-bcac4e137da9675a5ba2ba4dfe0404288749e33a.tar.gz
trunk - adding a py3util module that will normalize as many differences between this branch and the python3 branch as it can. First it includes a py3print call who's signature matches that of print in python3. Also removed a few byte strings of the form b''
Diffstat (limited to 'cherrypy/py3util.py')
-rw-r--r--cherrypy/py3util.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/cherrypy/py3util.py b/cherrypy/py3util.py
new file mode 100644
index 00000000..49387e2c
--- /dev/null
+++ b/cherrypy/py3util.py
@@ -0,0 +1,12 @@
+"""
+A simple module that helps unify the code between a python2 and python3 library.
+"""
+import sys
+
+def py3print(*args, **kwargs):
+ sep = kwargs.get('sep', ' ')
+ end = kwargs.get('end', '\n')
+ file = kwargs.get('file', sys.stdout)
+ output = sep.join(['%s' % arg for arg in args]) + end
+ file.write(output)
+