Page 1 of 1

Abstract class in MicroPython

Posted: Fri Oct 07, 2022 12:46 pm
by barbsbou
Dear community;

I would like to create a abstract class inherit from abc (Abstract Base Class) but I found nothing about lib ABC into micropython, maybe it is simply impossible or I did not search well....

Thank you for your replies and help!!

Re: Abstract class in MicroPython

Posted: Sun Oct 09, 2022 11:16 pm
by jimmo
This forum will be made read-only soon. Please post at GitHub Discussions.

MicroPython doesn't support abstract classes but if you're porting exisiting code that uses ABC, then you can just write an empty ABC class and abstractmethod decorator.

See
https://github.com/micropython/micropyt ... tdlib/abc/

Re: Abstract class in MicroPython

Posted: Mon Oct 10, 2022 1:53 pm
by barbsbou
Thank for your reply!!

Re: Abstract class in MicroPython

Posted: Thu May 25, 2023 8:17 am
by Jackli
Class name:
Phylum


class MyClass:
i=123

def f(self):
print("correct")