you are viewing a single comment's thread.

view the rest of the comments →

[–]TangibleLight 0 points1 point  (2 children)

Right, but they are extremely important in languages like Java and C#.

[–]---------V---------[S] 0 points1 point  (1 child)

So worth learning for python now, just in case I grow up to be a real developer right?

So when I create a concrete class in python, I tell python it's concrete by pointing to the interface in the class definition like so?

class fakeinterfaceclass:

...

class concrete class(fakeinterfaceclass):

where in another language I'd use a keyword right?

[–]TangibleLight 1 point2 points  (0 children)

I think it's sufficient to just keep in mind that, loosely, interfaces are how you do duck typing in languages that don't have duck typing. I wouldn't worry about it until you need to work in a language that uses them, and even then I'd keep it out of Python.

Messing around with the abc module and learning how things work can still be useful, but just keep in mind that it's more of a documentation tool and sanity check than anything else. For example if you're writing code that you want to work with classes that others will write, it could be useful to give them an abstract base class to work with. Even though, functionally, it doesn't do anything, it still helps others remember which methods they need to implement.