Skip to content

new declarations format for operators  #1

@lordlogo2002

Description

@lordlogo2002

Multiple/Single Argument Operator

Planend definiton

Currently operators can only be added if theri accept only two arguments.
Thats because off the way user input and validation is implemented.
But with this change the operators would be defined in this way:
operations.py:

OPERATIONS = {
  "<tag>": {
        "title": "Addition",
        "symbol": "+",
        "args": (
            "addend a",
            "addend b"
        ),
        "action": lambda a, b: a + b,
        "result-name": "sum"
    },
}
Key Description
Tag Used for internal logic to indicate format errors on tags
Title Indicates the calculation used, displayed in the help menu
Symbol The symbol that triggers the operator for use
Args A list of arguments requested from the user and passed in the specified order to the Callable
Action A Callable whose return value is the result
Result Name The name given to the result (e.g., "product")

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions