Update _erg_bytes.py

This commit is contained in:
Shunsuke Shibayama 2024-02-19 02:49:10 +09:00
parent 3869dd022e
commit 9b9be7fb2c

View file

@ -1,3 +1,6 @@
from _erg_result import Error
from _erg_range import Range
class Bytes(bytes):
def try_new(b): # -> Result[Nat]
if isinstance(b, bytes):
@ -6,7 +9,6 @@ class Bytes(bytes):
return Error("not a bytes")
def __getitem__(self, index_or_slice):
from _erg_range import Range
if isinstance(index_or_slice, slice):
return Bytes(bytes.__getitem__(self, index_or_slice))
elif isinstance(index_or_slice, Range):