• lascapi
    link
    fedilink
    arrow-up
    2
    ·
    7 months ago

    I discover the operator module! Amazing! 🤩

    The operator Module A third alternative to writing lambda functions is to use the standard library’s operator module. This module contains some predefined functions and function factories, which can replace the most common use cases for lambda functions. Let’s look at both of these separtaely, factories first. Another note: the function that attrgetter returns is implemented in C, so it’s slightly faster than using either a normal or lambda function.

    Useful if you want to speed up your code.