Skip to content

allow combining select* and reject* filters with boolean logic #2130

@flying-sheep

Description

@flying-sheep

Sequentially rejecting/selecting properties of list items isn’t powerful enough.

E.g. I’d like to do the following in a Sphinx autosummary template:

{% set shown_meths = [
   m for m in methods
   if m in abstract_methods or m not in inherited_methods
] %}
{% if shown_meths  %}
.. rubric:: Methods

{% for item in shown_meths %}
.. automethod:: {{ item }}
{%- endfor %}
{% endif %}

but that seems unnecessarily complex, and impossible if I care about not changing the order:

{% set regular_shown = methods | reject("in", inherited_methods) %}
{% set abstract_shown = abstract_methods | reject("in", abstract_shown) %}
{% set shuffled_shown_methods = regular_shown + abstract_shown %}

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