
PEP3100(杂项Python 3.0计划)的目标之一是:
[删除]
__oct__,__hex__使用:__index__在oct()和hex()代替。
要进行这项工作,您需要实现
__index__,可能是:
def __index__(self): # or self._value if you know _value is an integer already return operator.index(self._value)
您可以在此处查看更改此行为的提交:
r55905 | georg.brandl | 2007-06-11 10:02:26 -0700 (Mon, 11 Jun 2007) | 5lines
Remove __oct__ and __hex__ and use __index__ for convertingnon-ints before formatting in a base.Add a bin() builtin.
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)