Have to add that we work exclusively in strongly-typed languages. Kinda want to see how it plays out, but I can’t help but argue with him, so I think I’ll just go.

  • @[email protected]
    link
    fedilink
    33 months ago

    Considering there is typing in the code why is there no switch to enable type checking at runtime? PHP does this with a per file declare(strict_types) - why would python be unable to have either a global or per file flag to enable checks?

    • @[email protected]
      link
      fedilink
      103 months ago

      Typing when you need it gives you more freedom over a toggle. You can choose to type some parts of the code while leaving other parts untyped.

      For example, if I’m writing a quick and simple Python script I may forgo typing, but when iterating on it I’d go back and add the types I need.

      • @[email protected]
        link
        fedilink
        43 months ago

        This isn’t an issue, though. PHP has the same partial typing flexibility. There are ways to solve that issue and even typed PHP still allows union types including mixed which allows any types.

    • @[email protected]
      link
      fedilink
      English
      2
      edit-2
      3 months ago

      why is there no switch to enable type checking at runtime?

      Have you got problems this would solve? I’ve done a lot of type annotated Python at scale and I can’t think of an example.

      Edit: given nobody in their right mind allows code that’s not checker clean.