Changes between Version 5 and Version 6 of python2and3CompatiblityEN
- Timestamp:
- Jun 13, 2013, 1:18:23 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
python2and3CompatiblityEN
v5 v6 3 3 4 4 == The ''six'' compatibility library == 5 The [http://pythonhosted.org/six/ six] compatibility library aims to make writing code that is both Python 2 and 3 compatible easy by abstracting the main differences. 5 6 6 7 == Exception handling == … … 46 47 The ''u'' prefix used for marking up Unicode data in Python 2 is gone in Python 3.0-3.2, but was reintroduced in Python 3.3. The ''six'' compatibility library has the ''u()'' function, that can be used the replace the ''u'' prefix and abstract it's behavior in Python 2 & 3. 47 48 48 == Library renaming == 49 == Standard library renaming == 50 Some modules in in the Python standard library very renamed, moved and even split for Python 3. 51 52 The ''six'' library provides aliases for most moved and renamed modules, but does not cover modules that were split, such as the ''urllib'' module. Fortunately ''urrllib'' was only split while keeping the functions API-compatible. So a possible workaround is to only import the functions, such as ''urlopen'', not the whole module from the correct module, based on current Python version. 49 53 50 54 == The ''print()'' function ==