• rtxn@lemmy.world
    link
    fedilink
    arrow-up
    23
    ·
    2 days ago

    [lady for lady in ladies if lady.is_single] just doesn’t have the same bop.

    • lemmyman@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      2 days ago

      Can I just say that as someone who only codes tangentially to my work, code and documentation that uses the same word 2 or 3 times in an expression, when they mean different things, is such an immense pet peeve of mine when learning something new.

      I’m already struggling with everything else about it, and now I have to parse out which lady is which and what the hell each one is supposed to be

      object Object(object = object);

      Statements dreamed up by the utterly deranged.

      • Fushuan [he/him]@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        1
        ·
        15 hours ago

        All the lady in there are the same lady, it’s being used for different things as the other comment answered you but it’s the same box of information, if you will.

      • rtxn@lemmy.world
        link
        fedilink
        arrow-up
        6
        ·
        edit-2
        2 days ago

        That’s just Python’s generator syntax. Not all that difficult to parse once you get a feel for it. Plus syntax highlighting helps.

        (OUTPUT_EXPRESSION for ITEM in INPUT_ITERABLE if CONDITION)
        
    • alias_qr_rainmaker@lemmy.worldOP
      link
      fedilink
      arrow-up
      9
      ·
      2 days ago

      list comprehensions aren’t changed much. but a statement like dog = Dog(name="fido") is transpiled to the dog is now a Dog with name 'fido'

      the language uses backticks for strings. it handles nested stringly nicely because of it