• Heh, I was about to comment how my hot take is that Python is overrated. It’s… fine and I don’t really have anything against it for the most part, but I greatly prefer Ruby to Python.

      I’m speaking purely about the language itself here, not any libraries available for it (since someone will always point out how great Python is for data work).

      • Me too! Even just the fact that only false and nil are falsey is enough for me to prefer Ruby. Being able to use ||= as an idiomatic one-time initializer is rad. Python’s OOP bothers me in a lot of ways compared to Ruby as well. And don’t get me started on Ruby’s blocks. . .

      • Python has had syntax support for type annotations for a while now. The Python runtime doesn’t enforce the typing at all, but it can be enforced by a linter or by your IDE. And I believe you can introspect the type annotations at runtime, because they are actually part of the syntax.

        There’s even an alternative way of doing type annotations through specially formatted comments, just in case you might still need to write code that is backwards compatible with Python 2.

        @escapesamsara @navi @programming

        • mypy is great, but it doesn’t come close to what you can do with TypeScript. I don’t think that’s necessarily a jab at Python (though TypeVar’s limitations do come up here and there), more just throwing TypeScript on a pedestal.

            • I really wish Python had multi-line lambdas. Sadly Python is very opinionated in ways I don’t quite understand, but I can at least respect while using it.

              For interfaces, honestly all I can suggest is using an ABC with only @abstractmethods. It’s not perfect, but it’s basically what you’d do in C++ anyway. If you’re looking for an interface that models data, you could look at dataclasses or TypedDict (depending on what kind of data it is), but it’s just not going to match what’s possible in TS sadly (mapped types, conditional types, complex union types, custom type guards, etc).

    • For bigger projects, anything with MANDATORY types is a must for me. Optional, not compiler checked hinting doesn’t cut it.

      Not that i hate the language, but I do hate the tooling around it. I don’t think I’ve ever had a pleasant experience with setting up a Python project. And all the data stuff is just wrappers for code in other languages, making the packaging story even uglier, even harder.