mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 20:34:44 +00:00
Split std files
This commit is contained in:
parent
d38bdd9843
commit
2051692350
8 changed files with 187 additions and 173 deletions
10
compiler/erg_compiler/lib/std/_erg_str.py
Normal file
10
compiler/erg_compiler/lib/std/_erg_str.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
from _erg_result import Error
|
||||
|
||||
class Str(str):
|
||||
def __instancecheck__(cls, obj):
|
||||
return isinstance(obj, str)
|
||||
def try_new(s: str): # -> Result[Nat]
|
||||
if isinstance(s, str):
|
||||
return Str(s)
|
||||
else:
|
||||
return Error("Str can't be other than str")
|
Loading…
Add table
Add a link
Reference in a new issue