12

I read two articles about Metaclassing in python:

What is a metaclass in Python? http://jakevdp.github.io/blog/2012/12/01/a-primer-on-python-metaclasses/

And I read about the ABC(abstract base classes) which is presented at:

https://docs.python.org/2/library/abc.html.

So I have to ask: What is the difference between a metaclass and abstract base classes (ABC)?

As I can understand I can use both to define class creation from metaclasses (metaclass).

For what purpose I would use an ABC or 'my own' metaclass?

3
  • And stackoverflow.com/questions/3570796/… Commented Jul 7, 2014 at 16:43
  • 5
    An ABC is an ordinary class (meaning, its instances are arbitrary objects), it's an instance of type. A metaclass has other classes for instances, and it inherits from type (in addition to being an instance of type). Commented Jul 7, 2014 at 16:46
  • 1
    @delnan I did not think you could create an instance of an abstract base class. Commented Feb 15, 2015 at 21:24

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.