you are viewing a single comment's thread
view the rest of the comments
[–] 15 points 1 year ago (2 children)

You can annotate types in Python, and it's actually pretty nice when used with Pyright/Pylance.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 8 points 1 year ago (1 child)

    Oh, I know you can, but it's optional and the syntax is kind of weird. I prefer languages that are strongly typed from the ground up and enforce it.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 1 year ago (1 child)

    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#.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 1 year ago (1 child)

    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.

  • source
  • parent
  • hideshow 2 child comments
  • 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.

  • source
  • parent
  • [–] 3 points 1 year ago (1 child)

    But nobody else does, and I need it more on code I am consuming than producing. In fact, many functions rely on being able to send various types for different behavior. Dynamic programming is crazy to me. It's like guessing. I don't know what type your code is accepting and I have to guess based on the name of read your code directly.

  • source
  • parent
  • hideshow 2 child comments