Python 2 和 Python 3 的兼容層:Pies

jopen 11年前發布 | 15K 次閱讀 Pies Python開發

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.baiduhome.net/lib/view/home/1384601409618

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!