Skip to content

Commit

Permalink
fix: __help_repr__ function
Browse files Browse the repository at this point in the history
  • Loading branch information
Vardan2009 committed May 29, 2024
1 parent 1c3231d commit 0f142dd
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,10 @@ def __exec_len__(self):
except AttributeError:
return Null.null()

def __help_repr__(self) -> str:
result = str(self.operator("__help_repr__")[0])
return result

def bind_method(self, method: BaseFunction) -> RTResult[BaseFunction]:
method = method.copy()
if method.symbol_table is None:
Expand Down Expand Up @@ -1231,12 +1235,6 @@ def __repr__(self) -> str:
# TODO: make this overloadable as well
return f"<instance of class {self.parent_class.name}>"

def __help_repr__(self) -> str:
try:
return self.operator("__help_repr__")[0].value
except AttributeError:
return f"No custom help for class `{self.parent_class.name}`"


class BaseClass(Value, ABC):
name: str
Expand Down

0 comments on commit 0f142dd

Please sign in to comment.