SubQuery is an abstract base class (per the abc module) with one or more abstract methods that you did not override. By adding ABC to the list of base classes, you defined ValueSum itself to be an abstract base class. That means you aren't forced to override the methods, but it also means you cannot instantiate ValueSum itself.

PyCharm is warning you ahead of time that you need to implement the abstract methods inherited from SubQuery; if you don't, you would get an error from Python when you actually tried to instantiate ValueSum.


As to what inheriting from ABC does, the answer is... not much. It's a convenience for setting the metaclass. The following are equivalent:

class Foo(metaclass=abc.ABCMeta):
    ...

and

class Foo(abc.ABC):
    ...

The metaclass modifies __new__ so that every attempt to create an instance of your class checks that the class has implemented all methods decorated with @abstractmethod in a parent class.

Answer from chepner on Stack Overflow
🌐
Python
docs.python.org › 3 › library › abc.html
abc — Abstract Base Classes
This module provides the infrastructure for defining abstract base classes (ABCs) in Python, as outlined in PEP 3119; see the PEP for why this was added to Python.
Top answer
1 of 3
10

SubQuery is an abstract base class (per the abc module) with one or more abstract methods that you did not override. By adding ABC to the list of base classes, you defined ValueSum itself to be an abstract base class. That means you aren't forced to override the methods, but it also means you cannot instantiate ValueSum itself.

PyCharm is warning you ahead of time that you need to implement the abstract methods inherited from SubQuery; if you don't, you would get an error from Python when you actually tried to instantiate ValueSum.


As to what inheriting from ABC does, the answer is... not much. It's a convenience for setting the metaclass. The following are equivalent:

class Foo(metaclass=abc.ABCMeta):
    ...

and

class Foo(abc.ABC):
    ...

The metaclass modifies __new__ so that every attempt to create an instance of your class checks that the class has implemented all methods decorated with @abstractmethod in a parent class.

2 of 3
4

The 'Abstract Base classes" or abc.ABC is a helper class

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

Here's a snippet of why they exist:

The collections module has some concrete classes that derive from ABCs; these can, of course, be further derived. In addition, the collections.abc submodule has some ABCs that can be used to test whether a class or instance provides a particular interface, for example, if it is hashable or if it is a mapping.

A good example here: https://pymotw.com/2/abc/ | https://pymotw.com/3/abc/

From pymotw:

Forgetting to set the metaclass properly means the concrete implementations do not have their APIs enforced. To make it easier to set up the abstract class properly, a base class is provided that sets the metaclass automatically.

abc_abc_base.py
import abc


class PluginBase(abc.ABC):

    @abc.abstractmethod
    def load(self, input):
        """Retrieve data from the input source
        and return an object.
        """

    @abc.abstractmethod
    def save(self, output, data):
        """Save the data object to the output."""


class SubclassImplementation(PluginBase):

    def load(self, input):
        return input.read()

    def save(self, output, data):
        return output.write(data)


if __name__ == '__main__':
    print('Subclass:', issubclass(SubclassImplementation,
                                  PluginBase))
    print('Instance:', isinstance(SubclassImplementation(),
                                  PluginBase))
Discussions

Understanding abc.ABC
If I have class A and then I derive subclass B from it wouldn't issubclass(B,A) still be true? Usually, yes, unless you do something weird with metaclasses maybe. I do not understand what abstract classes give you. You can think of them as some kind of "contracts"; any class inheriting from them implicitly makes a promise to support the interface defined by the abstract base class. It's not nearly as binding or robust as something like Rust's trait system, but it can still come in handy sometimes. For example, os.PathLike is an abstract base class that defines a common interface all path-like objects, such as pathlib.Path, must fulfill to be compatible with most standard library functions expecting filepaths as arguments. The subclasses can add more functionality on top of the required methods, but they are forced to at least have the ones set by the abstract base class. In other words, you can always count on those being available no matter what kind of subclass you're getting. More on reddit.com
🌐 r/learnpython
5
1
June 20, 2023
Protocols vs Abstract Base Classes in Python
I'm going to add that performance for protocols is bad when doing an instance check. It's O(n) where n is the size of the interface, and they're not cheap checks. For example, I improved performance in ReactPy by 50% by removing a single isinstance check against a protocol that was done every render. More on reddit.com
🌐 r/Python
31
121
December 1, 2024
A way to disable virtual subclassing with ABC classes - Ideas - Discussions on Python.org
There is a long standing issue with ABC classes in CPython (both the C and pure Python implementation), that causes memory and performance issues when you have a large number of subclasses. Looking into the _py_abc implementation, I came to the same conclusions as this comment, and I think ... More on discuss.python.org
🌐 discuss.python.org
3
January 19, 2025
ABC Export Selection with Python
Think I found the issue. In the UI it's OK to select just the transforms but in the ABCExport command you need to select the shape node. More on reddit.com
🌐 r/Maya
6
4
October 31, 2020
🌐
Michelfailing
blog.michelfailing.de › abc-in-python
Why Python's Abstract Base Classes help you to write better code for your Data Science projects
February 20, 2023 - Abstract Base Classes (ABCs) are a type of class in Python that cannot be instantiated on their own. Instead, they are used as a template for other classes, providing a common set of attributes and methods that the other classes must implement.
🌐
Reddit
reddit.com › r/learnpython › understanding abc.abc
r/learnpython on Reddit: Understanding abc.ABC
June 20, 2023 -

I am being asked to maintain code that subclasses from abc.ABC. I have read the python documentation, the associated PEP, and even visited pymotw. I do not understand what abstract classes give you.

If I have class A and then I derive subclass B from it wouldn't issubclass(B,A) still be true?

Top answer
1 of 4
4
If I have class A and then I derive subclass B from it wouldn't issubclass(B,A) still be true? Usually, yes, unless you do something weird with metaclasses maybe. I do not understand what abstract classes give you. You can think of them as some kind of "contracts"; any class inheriting from them implicitly makes a promise to support the interface defined by the abstract base class. It's not nearly as binding or robust as something like Rust's trait system, but it can still come in handy sometimes. For example, os.PathLike is an abstract base class that defines a common interface all path-like objects, such as pathlib.Path, must fulfill to be compatible with most standard library functions expecting filepaths as arguments. The subclasses can add more functionality on top of the required methods, but they are forced to at least have the ones set by the abstract base class. In other words, you can always count on those being available no matter what kind of subclass you're getting.
2 of 4
4
Abstract base classes are just classes that aren't meant to be instantiated. It is like a wireframe for shared methods / attributes, without the ABC itself being a legitimate object type. It works the same as regular subclassing in most ways. ABCs usually have the shared methods defined so that if you make a subclass of it and it doesn't implement something the interface was expected to it will throw an error. class PersonNormal: def __init__(self, name: str): self.name = name def say_hi(self): print(f"Hi, I'm {self.name}") class PersonABC(ABC): def __init__(self, name): ... @abstractmethod def say_hi(self): ... class Student(Person): def __init__(self, name: str): super().__init__(name) class Teacher(Person) def __init__(self, name: str): super().__init__(name) def say_hi(self): print(f"Good morning, I'm Mr. {self.name}") # inheriting from PersonNormal A = Person('John') B = Student('Peter') C = Teacher('Tom') A.say_hi() # calls Person.say_hi normally B.say_hi() # calls Person.say_hi since it wasn't overwritten C.say_hi() # calls Teacher.say_hi # inheriting from PersonABC A = Person('John') # TypeError can't instantiate abstract class Person... B = Student('Peter') # TypeError since you didn't overwrite the method C = Teacher('Tom') # works as expected
🌐
Wikipedia
en.wikipedia.org › wiki › Guido_van_Rossum
Guido van Rossum - Wikipedia
1 week ago - He has explained that Python's predecessor, ABC, was inspired by SETL, noting that ABC co-developer Lambert Meertens had "spent a year with the SETL group at NYU before coming up with the final ABC design".
🌐
GeeksforGeeks
geeksforgeeks.org › python › abstract-base-class-abc-in-python
Abstract Base Class (abc) in Python - GeeksforGeeks
July 15, 2025 - Python has a module called abc (abstract base class) that offers the necessary tools for crafting an abstract base class. First and foremost, you should understand the ABCMeta metaclass provided by the abstract base class.
Find elsewhere
🌐
Sinavski
sinavski.com › home › interfaces abc vs. protocols
Interfaces: abc vs. Protocols - Oleg Sinavski
August 1, 2021 - Python is somewhat different from other popular languages since there are no interfaces on a language level. However, there are several library implementations: ... from abc import ABC, abstractmethod class Animal(ABC): @abstractmethod def eat(self, food) -> float: pass @abstractmethod def sleep(self, hours) -> float: pass
🌐
ActiveState
docs.activestate.com › activepython › 2.7 › python › library › abc.html
28.8. abc — Abstract Base Classes
April 20, 2020 - You should upgrade and read the Python documentation for the current stable release. ... New in version 2.6. ... This module provides the infrastructure for defining abstract base classes (ABCs) in Python, as outlined in PEP 3119; see the PEP for why this was added to Python.
🌐
Real Python
realpython.com › ref › glossary › abstract-base-class
abstract base class (ABC) | Python Glossary – Real Python
In Python, an abstract base class (ABC) is a class that can’t be instantiated on its own and is designed to be a blueprint for other classes, allowing you to define a common interface for a group of related classes.
🌐
Python Course
python-course.eu › oop › the-abc-of-abstract-base-classes.php
20. The 'ABC' of Abstract Base Classes | OOP | python-course.eu
Our example implemented a case of simple inheritance which has nothing to do with an abstract class. In fact, Python on its own doesn't provide abstract classes. Yet, Python comes with a module which provides the infrastructure for defining Abstract Base Classes (ABCs).
🌐
Plain English
python.plainenglish.io › decoding-pythons-abc-module-a-comprehensive-guide-c22b514c701e
Decoding Python’s ABC Module: A Comprehensive Guide | by CyCoderX | Python in Plain English
August 21, 2024 - If you try to create an instance of MyClass without implementing my_method, Python will raise a TypeError. Let’s consider a scenario where we want to create an abstract base class called Animal with two abstract methods: eat and sleep. from abc import ABC, abstractmethod class Animal(ABC): @abstractmethod def eat(self, food): """ Abstract method to define how an animal eats.
🌐
DEV Community
dev.to › leapcell › elegant-abstractions-mastering-abcs-in-advanced-python-4k6d
Elegant Abstractions: Mastering Abstract Base Classes in Advanced Python - DEV Community
May 2, 2025 - class ABC(metaclass=ABCMeta): """Helper class that provides a standard way to create an ABC using inheritance. """ pass · The code is more concise. It is more in line with the principle of simplicity and intuitiveness in Python.
🌐
W3Schools
w3schools.com › python › ref_module_abc.asp
Python abc Module
The abc module provides tools for creating Abstract Base Classes (ABCs) and decorators for abstract methods.
🌐
DataCamp
datacamp.com › tutorial › python-abstract-classes
Python Abstract Classes: A Comprehensive Guide with Examples | DataCamp
January 22, 2025 - The ABC class is a built-in Python feature that serves as a fundamental basis for developing abstract classes. You must inherit from ABC to define an abstract class. The class is abstract and cannot be instantiated directly, as indicated by this inheritance.
🌐
Codevisionz
codevisionz.com › home › abstract base classes (abc) in python
Abstract Base Classes (ABC) in Python: A Complete Guide
October 9, 2024 - Abstract Base Classes (ABC) provide a way to define abstract classes, which are classes that cannot be instantiated on their own and are meant to be subclassed.
🌐
Reddit
reddit.com › r/python › protocols vs abstract base classes in python
r/Python on Reddit: Protocols vs Abstract Base Classes in Python
December 1, 2024 -

Hi everyone. Last time I shared a post about Interface programming using abs in Python, and it got a lot of positive feedback—thank you!

Several people mentioned protocols, so I wrote a new article exploring that topic. In it, I compare protocols with abstract base classes and share my thoughts and experiences with both. You can check it out here: https://www.tk1s.com/python/protocols-vs-abstract-base-classes-in-python Hope you'll like it! Thanks!

🌐
Stackademic
blog.stackademic.com › pythons-abstract-base-classes-abcs-the-hidden-power-of-interfaces-262349f61216
Python's Abstract Base Classes (ABCs) — The Hidden ...
February 6, 2025 - Stackademic is a learning hub for programmers, devs, coders, and engineers. Our goal is to democratize free coding education for the world.
🌐
Python.org
discuss.python.org › ideas
A way to disable virtual subclassing with ABC classes - Ideas - Discussions on Python.org
January 19, 2025 - There is a long standing issue with ABC classes in CPython (both the C and pure Python implementation), that causes memory and performance issues when you have a large number of subclasses. Looking into the _py_abc impl…
🌐
Medium
gabrielgomes61320.medium.com › pythons-abc-enforcing-patterns-in-classes-to-ensure-systems-integrations-9ba8ceafaa59
Python’s ABC: Enforcing patterns in classes to ensure systems integrations | by Gabriel Gomes, PhD | Medium
April 29, 2024 - In the vast landscape of Python libraries, there are a few hidden gems that can truly transform the way we approach class creation and ensure the consistency of our codebase. Among them, the Abstract Base Classes (ABC) library stands out as ...
🌐
PyPI
pypi.org › project › python-abc
python-abc · PyPI
September 19, 2021 - A python implementation of the ABC Software metric
      » pip install python-abc
    
Published   Jan 02, 2026
Version   0.3.0