Sunday, September 21, 2014

"six" module

python 有個模組(module)名為 "six"

python 2 與 python 3 有些語法(syntax)上的差異
例如
print 'xxxx' --> print('xxxx')

資料型別也有些更動
例如
unicode, basestring, str  --> str

物件模型(object-model) 的差異?

"six" 模組的目標就是希望彌平(smoothing) python2 與 python3 的差異
讓python程式碼能夠同時用在兩個版本上.



//=== https://pypi.python.org/pypi/six
"""
...
Six is a Python 2 and 3 compatibility library.
It provides utility functions for smoothing over the differences between the Python versions
with the goal of writing Python code that is compatible on both Python versions.

...
Six supports every Python version since 2.5.
It is contained in only one Python file, ...

...
Author: Benjamin Peterson

...
Package Index Owner: gutworth
DOAP record: six-1.8.0.xml

...

"""


[ref]
https://pypi.python.org/pypi/six
http://pythonhosted.org/six/

No comments:

Post a Comment