豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 771 Bytes

File metadata and controls

17 lines (14 loc) · 771 Bytes

Polyfills - stdlib

Backporting of some of the features natively available in newer Python versions:

  • bool class (as well as True and False)
  • sorted() function (Python 2.4)
  • sum() function (Python 2.3)
  • enumerate() function (Python 2.3)
  • print() function (keyword arguments such as end or sep were added in Python 3.3, see module docstring for more details)
  • NotImplementedError exception (Python 2.2)
  • set() class (Python 2.4)

For a quick one-time workaround for True and False:

exec("try: (True, False)\nexcept NameError: exec('True = 1==1; False = 1==0')")