Changes between Version 5 and Version 6 of python2and3CompatiblityEN


Ignore:
Timestamp:
Jun 13, 2013, 1:18:23 AM (11 years ago)
Author:
Martin Kolman
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • python2and3CompatiblityEN

    v5 v6  
    33
    44== The ''six'' compatibility library ==
     5The [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.
    56
    67== Exception handling ==
     
    4647The ''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.
    4748
    48 == Library renaming ==
     49== Standard library renaming ==
     50Some modules in in the Python standard library very renamed, moved and even split for Python 3.
     51
     52The ''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.
    4953
    5054== The ''print()'' function ==