₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,143 members, 8,510,357 topics. Date: Friday, 30 October 2026 at 09:40 AM

Toggle theme

Dear Python Programmer, How Do You Implement Interfaces, Abstract Classes - Programming - Nairaland

Nairaland Forum › Science/Technology › Programming › Dear Python Programmer, How Do You Implement Interfaces, Abstract Classes (528 Views)

1 Reply (Go Down)

Dear Python Programmer, How Do You Implement Interfaces, Abstract Classes by Karleb(op): 8:36am On Nov 25, 2020
I noticed python doesn't come with come with easy and clear way to implement interface and abstract class and because of this, some python articles I've read played down on the importance of these in python.


How do you as a python programmer implement these especially before python 3?

Does popular frameworks like Django and Flask have abstract classes and interfaces?
Re: Dear Python Programmer, How Do You Implement Interfaces, Abstract Classes by Taofeekdboy(m): 5:38pm On Nov 25, 2020
Karleb:
I noticed python doesn't come with come with easy and clear way to implement interface and abstract class and because of this, some python articles I've read played down on the importance of these in python.


How do you as a python programmer implement these especially before python 3?

Does popular frameworks like Django and Flask have abstract classes and interfaces?
In Python Class, We have Encapsulation, Polymorphization, Abstraction and Inheritance.
Each of the above terms has its own function and you can implement abstraction especially in Django, cos all you need to write inside the class is abstraction = True.
Re: Dear Python Programmer, How Do You Implement Interfaces, Abstract Classes by Petchu(m): 1:21pm On Nov 26, 2020
#Abstract classes:

from abc import ABCMeta, abstractmethod
class Petchu(metaclass = ABCMeta):
@abstractmethod
def petchu(pself):
pass

#so this would return an exception:
peter = Petchu ()
Re: Dear Python Programmer, How Do You Implement Interfaces, Abstract Classes by Petchu(m): 1:23pm On Nov 26, 2020
Interfaces could be implemented a number of ways probably by augmented class methods
1 Reply

As A Programmer, How Are You Coping In This Economy? • As A Programmer How Do You Learn/understand A New Language • I Want My Son To Be A Programmer, How Do I Go About It • 2 • 3 • 4

Effective Methods To Grasp JAVASCRIPT Easily. • How To Create Custom User Model In Django(python) • Is Javascript The Future?