Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,877 members, 7,802,830 topics. Date: Friday, 19 April 2024 at 10:48 PM

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 (405 Views)

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)

(1) (Reply) (Go Down)

Dear Python Programmer, How Do You Implement Interfaces, Abstract Classes by Karleb(m): 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 ()

1 Like

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)

Need A Developer To Reskin A Complete Script / Premium Wordpress Theme And Plugins / Get Lastest Php Script For Transportation And Tracking Website

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 8
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.