Skip to content

Commit

Permalink
Update _erg_bytes.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Feb 18, 2024
1 parent 918f146 commit 9e2beff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/erg_compiler/lib/core/_erg_bytes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
class Bytes(bytes):
def try_new(*b): # -> Result[Nat]
return Bytes(bytes(*b))
def try_new(b): # -> Result[Nat]
if isinstance(b, bytes):
return Bytes(bytes(b))
else:
return Error("not a bytes")

def __getitem__(self, index_or_slice):
from _erg_range import Range
Expand Down

0 comments on commit 9e2beff

Please sign in to comment.