Python 2 和 Python 3 的兼容层:Pies

jopen 11年前

Pies 实现了一个 Python 2 和 Python 3 的兼容层,所有代码都是 Python 3 的,相当于是在 Python 3 上实现对 Python 2 的兼容性。

Works Unchanged (The Good)

The best part of Pies is how much Python3 code works unchanged in Python2

Functions:

  • round
  • next
  • filter
  • map
  • zip
  • input
  • range

Types:

  • chr (creates a unichr object in Python2)
  • str (creates a unicode object in Python2)
  • dict (creating a dict using dict() will give you all the special Python3 itemview results, but using {} will not)

Imports:

  • html
  • http
  • xmlrpc
  • _thread
  • builtins
  • configparser
  • copyreg
  • queue
  • reprlib
  • socketserver
  • ipaddress
  • argparse
  • enum (also adds this library to Python 3.0-3.3)

Python 2 和 Python 3 的兼容层:Pies


 

项目主页:http://www.open-open.com/lib/view/home/1384601409618