fix: Python 3.9 bugs

This commit is contained in:
Shunsuke Shibayama 2023-09-13 02:52:32 +09:00
parent f157673c59
commit 75c1ac733c
8 changed files with 105 additions and 40 deletions

View file

@ -9,6 +9,12 @@ class Int(int):
else:
return Error("not an integer")
def bit_count(self):
if hasattr(int, "bit_count"):
return int.bit_count(self)
else:
return bin(self).count("1")
def succ(self):
return Int(self + 1)