Open eonu opened 1 month ago
Bit of a wild proposition, and would probably be a big project, but basic example:
import feud class Number: def __init__(self, value: int, /) -> None: self.value = value def add(self, summand: int) -> int: return self.value + summand if __name__ == "__main__": number = Number(10) feud.run(number, ["add", "5"], standalone_mode=False) # => 15 feud.run(number.add, ["5"], standalone_mode=False) # => 15
Should ideally support instance methods, class methods, static methods, properties/setters.
Probably needs to store the object in ctx and generate commands based on the object's members, which are forwarded to the corresponding method.
ctx
Help could maybe display class docstring plus set attribute values (e.g. self.value = 10) in the example above.
self.value = 10
Does this suggestion already exist?
Feature description
Bit of a wild proposition, and would probably be a big project, but basic example:
Should ideally support instance methods, class methods, static methods, properties/setters.
Probably needs to store the object in
ctx
and generate commands based on the object's members, which are forwarded to the corresponding method.Help could maybe display class docstring plus set attribute values (e.g.
self.value = 10
) in the example above.