mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 21:01:10 +00:00
Update _erg_std_prelude.py
This commit is contained in:
parent
392812b150
commit
4fb43e520e
1 changed files with 3 additions and 3 deletions
|
@ -26,13 +26,13 @@ def in_operator(x, y):
|
|||
return True
|
||||
# TODO: trait check
|
||||
return False
|
||||
elif (type(y) == list or type(y) == set) \
|
||||
elif (issubclass(type(y), list) or issubclass(type(y), set)) \
|
||||
and (type(y[0]) == type or issubclass(type(y[0]), Range)):
|
||||
# FIXME:
|
||||
type_check = in_operator(x[0], y[0])
|
||||
len_check = len(x) == len(y)
|
||||
return type_check and len_check
|
||||
elif type(y) == dict and type(next(iter(y.keys()))) == type:
|
||||
elif issubclass(type(y), dict) and issubclass(type(next(iter(y.keys()))), type):
|
||||
# TODO:
|
||||
type_check = True # in_operator(x[next(iter(x.keys()))], next(iter(y.keys())))
|
||||
len_check = len(x) >= len(y)
|
||||
|
@ -68,7 +68,7 @@ class Bool(Nat):
|
|||
|
||||
class Str(str):
|
||||
def __instancecheck__(cls, obj):
|
||||
return obj == Str or obj == str
|
||||
return isinstance(obj, str)
|
||||
|
||||
def try_new(s: str): # -> Result[Nat]
|
||||
if isinstance(s, str):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue