python2和python3的不同点_Django python2和python3的区别
查看django源碼six.py,發現Django在python2和python3的區別:if PY3:
string_types = str,
integer_types = int,
class_types = type,
text_type = str
binary_type = bytes
MAXSIZE = sys.maxsize
else:
string_types = basestring,
integer_types = (int, long)
class_types = (type, types.ClassType)
text_type = unicode
binary_type = str
# 判斷是不是Jython
if sys.platform.startswith("java"):
# Jython always uses 32 bits.
MAXSIZE = int((1 << 31) - 1)
else:
# It's possible to have sizeof(long) != sizeof(Py_ssize_t).
class X(object):
def __len__(self):
return 1 << 31
try:
len(X())
except OverflowError:
# 32-bit
MAXSIZE = int((1 << 31) - 1)
else:
# 64-bit
MAXSIZE = int((1 << 63) - 1)
del X
從代碼可以看出Django在py2和py3區別還是挺明顯
總結
以上是生活随笔為你收集整理的python2和python3的不同点_Django python2和python3的区别的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 通宝钱系代替五铢钱系出自哪个朝代
- 下一篇: 中国核工业是国企吗