• sugar_in_your_tea@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 days ago

    Python is strongly typed, it’s just not statically typed. Python with consistent type hinting is extremely similar to a statically typed language like C#.

    • kescusay@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 days ago

      I would argue that without consistent and enforced type hinting, dynamically typed languages offer very little benefit from type-checking at runtime. And with consistent, enforced type hinting, they might as well be considered actual statically typed languages.

      Don’t get me wrong, that’s a good thing. Properly configured Python development environments basically give you both, even if I’m not a fan of the syntax.

      • sugar_in_your_tea@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        arrow-down
        1
        ·
        3 days ago

        What’s wrong with the syntax? It’s just var_name: Type = value, it’s very similar to Go or Rust. Things get a little wonky with generics (list[Type] or dict[Type]), but it’s still similar to other languages.

        One nice thing about it being runtime checked is you can accept union types, def func(param: int | float), which isn’t very common in statically typed languages.