337
What are your programming hot takes?
(lemmy.ml)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
@TehPers I really wish Python had a satisfying way to do interfaces.
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@abstractmethod
s. 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 orTypedDict
(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).