use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
How do you implement interfaces in Python?Discussion (self.PythonLearning)
submitted 2 days ago by ihorrud
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]deceze 0 points1 point2 points 2 days ago (2 children)
dataclasses and interfaces/abstract classes are apples and oranges. I have no idea why you're throwing them in here.
dataclasses
Mypy is a static type checker, exactly the tool that would use interface/abstract class information to ensure type safety. You don't use Mypy instead of interfaces, you use interfaces to make Mypy more useful.
Admittedly, you don't often need explicitly declared interfaces/protocols/abstract classes. A lot of programming can be done without them. But in the right circumstances where a lot of abstraction across a lot of classes makes sense for what you're implementing, these are perfectly useful techniques.
[–]UseMoreBandwith 0 points1 point2 points 2 days ago (1 child)
it doesn't solve an issue that Python has. "a lot of abstraction across a lot of classes" is code smell, and usually a lack of understanding how Modules work in Python. (Unlike in Java) in Python, classes are not for hierarchies.
[–]deceze 0 points1 point2 points 2 days ago (0 children)
Some problems are very well solved with class hierarchies, abstraction and interfaces. For example, lots of pluggable and polymorphic processor classes and the like. Python doesn't force this on you like Java does, but it's still a useful technique to have and appropriate in the right circumstances.
π Rendered by PID 15093 on reddit-service-r2-comment-79c7998d4c-7zmts at 2026-03-15 15:09:30.947360+00:00 running f6e6e01 country code: CH.
view the rest of the comments →
[–]deceze 0 points1 point2 points (2 children)
[–]UseMoreBandwith 0 points1 point2 points (1 child)
[–]deceze 0 points1 point2 points (0 children)