Skip to content

sort subfunction #737

Answered by ALERTua
melmager asked this question in Q&A
Discussion options

You must be logged in to vote

lambda works fine:

@service
def get_new_price(trigger_type=None, var_name=None, value=None, old_value=None, context=None, **kwargs):
    daten = [
        {'date': '2025-07-15T05:00:00.000Z', 'price': 29.36},
        {'date': '2025-07-15T06:00:00.000Z', 'price': 28.58}
    ]

    result = sorted(daten, key=lambda x: x['price'], reverse=False)
    log.debug(f"{__name__}:\n{str_.__class__.__name__} {str_}")

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by melmager
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants