Prevent instantiation of an abstract class

Viewed 2608

In Java, we can prevent instantiation of a class by making it an abstract class. I thought python would behave the same way. But to my surprise, I found that I can create an object of an abstract class:

from abc import ABCMeta
class Foo(metaclass=ABCMeta):
    pass
Foo()

Why does python allow this and how can I prevent this?

1 Answers
Related