7

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?

Community
  • 1
  • 1
arthas_dk
  • 341
  • 4
  • 13
  • 1
    possible duplicate of [What is a metaclass in Python?](http://stackoverflow.com/questions/100003/what-is-a-metaclass-in-python) – vaultah Jul 07 '14 at 16:43
  • And http://stackoverflow.com/questions/3570796/why-use-abstract-base-classes-in-python – vaultah Jul 07 '14 at 16:43
  • 3
    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`). –  Jul 07 '14 at 16:46
  • 1
    @delnan I did not think you could create an instance of an abstract base class. – Anthony Rutledge Feb 15 '15 at 21:24

0 Answers0