mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
fix: Python 3.7~3.8 bugs
This commit is contained in:
parent
75c1ac733c
commit
aacdca31b8
6 changed files with 35 additions and 4 deletions
6
crates/erg_compiler/lib/std/_erg_builtins.py
Normal file
6
crates/erg_compiler/lib/std/_erg_builtins.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
# in Python 3.7, `sum` takes no keyword arguments
|
||||
def sum(iterable, start=0):
|
||||
s = start
|
||||
for i in iterable:
|
||||
s += i
|
||||
return s
|
|
@ -14,6 +14,8 @@ def contains_operator(y, elem) -> bool:
|
|||
return True
|
||||
elif hasattr(y, "try_new") and is_ok(y.try_new(elem)):
|
||||
return True
|
||||
elif hasattr(y, "__origin__") and hasattr(y.__origin__, "type_check"):
|
||||
return y.__origin__.type_check(elem, y)
|
||||
# TODO: trait check
|
||||
return False
|
||||
# [1] in [Int]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue