[core] add pyCompatibility module

For python 2 / 3 compatibility
This commit is contained in:
Fabien Castan 2018-05-21 17:12:22 +02:00
parent 1c16199ca4
commit d83022714f
4 changed files with 28 additions and 23 deletions

View file

@ -0,0 +1,15 @@
try:
unicode = unicode
except NameError:
# 'unicode' is undefined, must be Python 3
str = str
unicode = str
bytes = bytes
basestring = (str, bytes)
else:
# 'unicode' exists, must be Python 2
str = str
unicode = unicode
bytes = str
basestring = basestring