python 3的ipaddress模块的后台端口
backport_ipaddress的Python项目详细描述
backport_collections是python 2.6和python2.7的python 3的ipaddress模块的一个backport。 它基于s_ren l_vborg(https://bitbucket.org/kwi/py2-ipaddress/)的后台端口。
什么是后门?
ipaddress模块。
用法
要使用它,只需像在python 3中那样导入模块ipaddress。 示例:
import ipaddress
差异
鉴于python 2中没有真正的bytes类型,我们使用的是bytearray,它是 在python 2中,bytes的可变版本有更少的方法。
因此,如果在python 3中,您可以这样做:
ipaddress.ip_address(b'\x00\x00\x00\x00')
使用此端口,您需要执行以下操作:
ipaddress.ip_address(bytearray('\x00\x00\x00\x00'))
缺少
有一点是缺失的,可能对性能很重要的是 lru_cache对于许多方法。^ python 2中的{tt8}$没有 这样的装潢师。也许将来我也会支持这种方法。
许可证
python软件基金会许可证。
更改
- v0.1(2014年8月15日):同步到修订版http://hg.python.org/cpython/rev/15bfb82194fa