Skip to content

Support comparison chaining #60

@k3an3

Description

@k3an3

In Python, the following syntax is valid:

>>> x = 7
>>> 5 < x < 10
True
>>> x = 1
>>> 5 < x < 10
False

However, this does not work in py-expression-eval:

>>> from py_expression_eval import Parser
>>> parser = Parser()
>>> parser.parse('5 < x < 10').evaluate({'x': 7})
True
>>> parser.parse('5 < x < 10').evaluate({'x': 1})
True

The last result is unexpected; the parser unconditionally returns True when chaining comparison.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions