• _stranger_@lemmy.world
    link
    fedilink
    arrow-up
    5
    arrow-down
    1
    ·
    2 months ago

    Heh, so in Python it’s possible to overload operators in the context of objects. I bet it would be possible to overload tabs to do the same thing as colons inside a context manager, but that’s pure speculation.

    • frezik@midwest.social
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      IIRC, Python handles whitespace indentation by having the tokenizer convert them to INDENT/DEDENT tokens. The grammar can then handle them equivalently to a curly brace language.