Skip to content

How do I use Expr.in_? #201

@hanjinliu

Description

@hanjinliu
  • app-model version: 0.2.7
  • Python version: 3.11.9
  • Operating System: Windows 11

Description

The in_ method seems not working with a constant list.
What I wanted to do was to use a ContextNamespace ctx and make a enablement statement like ctx.window_state.in_(["minimized", "maximized"]). I think I can make it work by defining another ContextKey that always returns a constant list, but I think there should be some easier way to do that.

What I Did

expr = Constant(1).in_(Constant(2))  # <- not working, as a constant is not iterable
expr = Constant(1).in_([1, 2])  # <- not working, as a list is not a constant
expr = Constant(1).in_(ast.List(1, 2))  # <- not working, as a ast.List is not a constant

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