The thing I love about python is it’s elegance; and I thing that is partially due to its syntactic sugar. Between list comprehensions, destructuring, enumerators, generators with yield, and a bunch more, what is your favorite

  • namingthingsiseasy
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    List comprehensions, dict comprehensions, set comprehensions, and generator expressions. They just make it so fast and easy to transform data.

    Also just generators in general. I really like how they save unnecessary computation (when used prudently of course!).

    And I’m also a big fan of list indexing, especially how you can extract the last three elements of a list using l[-3:]. Very elegant syntax