mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 12:14:43 +00:00
fix: Python 3.9 bugs
This commit is contained in:
parent
f157673c59
commit
75c1ac733c
8 changed files with 105 additions and 40 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue