This is just a way to declare a and b as equal to c.

>>> c=2
>>> a=b=c
>>> a
2
>>> b
2
>>> c
2

So you can use as much as you want:

>>> i=7
>>> a=b=c=d=e=f=g=h=i

You can read more in Multiple Assignment from this Python tutorial.

Python allows you to assign a single value to several variables simultaneously. For example:

a = b = c = 1

Here, an integer object is created with the value 1, and all three variables are assigned to the same memory location. You can also assign multiple objects to multiple variables. For example:

a, b, c = 1, 2, "john"

Here, two integer objects with values 1 and 2 are assigned to variables a and b, and one string object with the value "john" is assigned to the variable c.


There is also another fancy thing! You can swap values like this: a,b=b,a:

>>> a=2
>>> b=5
>>> a,b=b,a
>>> a
5
>>> b
2
Answer from fedorqui on Stack Overflow
🌐
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 - Of course that the way those actions are done in different account types can change (as we can see from the Checking and Savings accounts), but we NEED to have a concrete implementation for the deposit and withdraw actions, otherwise we will have a TypeError in our code when we try to instantiate objects from the classes that don’t contain concrete implementations for those two methods (like it was the case with our AccountWithNoWithdrawAndDeposit class). In this post, a simple introduction to the ABC Python library was presented, where we discussed an application to a simple banking system with different types of bank accounts that must contain specific functionalities.
🌐
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
🌐
John D. Cook
johndcook.com › blog › 2012 › 04 › 03 › a-b-c
a < b < c
April 3, 2012 - In Python, and in some other languages, the expression a < b < c is equivalent to a < b and b < c. For example, the following code outputs “not increasing.”
🌐
Python
docs.python.org › 3 › library › abc.html
abc — Abstract Base Classes
You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as “virtual subclasses” – these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won’t show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()). [1] Classes created with a metaclass of ABCMeta have the following method: ... Register subclass as a “virtual subclass” of this ABC. For example:
🌐
Real Python
realpython.com › ref › stdlib › abc
abc | Python Standard Library – Real Python
In this example, the abc module ensures that any class claiming to be a Plugin must implement the .run() method, providing a consistent interface for executing plugins. ... In this tutorial, you'll explore how to use a Python interface. You'll come to understand why interfaces are so useful and learn how to implement formal and informal interfaces in Python.
🌐
Medium
medium.com › analytics-vidhya › abc-in-python-abstract-base-class-35808a9d6b32
ABC in Python (Abstract Base Class) | by nijanthan | Analytics Vidhya | Medium
March 12, 2024 - Both the steps are similar. Note: The type of ABC ( type(ABC) ) is still ABCMeta. therefore inheriting from ABC requires the usual precautions regarding metaclass usage, as multiple inheritance may lead to metaclass conflicts.
Find elsewhere
🌐
Justin A. Ellis
jellis18.github.io › post › 2022-01-11-abc-vs-protocol
Abstract Base Classes and Protocols: What Are They? When To Use Them?? Lets Find Out! - Justin A. Ellis
January 11, 2022 - Protocols were introduced in PEP-544 as a way to formally incorporate structural subtyping (or "duck" typing) into the python type annotation system. There are two main, but related, use cases for Protocols. First, they can be used as an interface for classes and functions which can be used downstream in other classes or functions. Secondly, they can be used to set bounds on generic types. Protocols allow you to define an interface for a class or function that will be type checked on usage rather than on creation. For example, we can make our Animal ABC above a Protocol
🌐
W3Schools
w3schools.com › python › ref_module_abc.asp
Python abc Module
Built-in Modules Random Module Requests Module Statistics Module Math Module cMath Module · Remove List Duplicates Reverse a String Add Two Numbers · Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview ...
🌐
GitHub
github.com › python › cpython › blob › main › Lib › abc.py
cpython/Lib/abc.py at main · python/cpython
# We check for __abstractmethods__ here because cls might by a C · # implementation or a python implementation (especially during · # testing), and we want to handle both cases. return cls · · abstracts = set() # Check the existing abstract methods of the parents, keep only the ones ·
Author   python
🌐
The Python Coding Stack
thepythoncodingstack.com › p › and-now-you-know-your-abc-python-abstract-base-classes
And Now You Know Your ABC - by Stephen Gruppetta
November 1, 2025 - The abstract base class includes the method .finalise_results(), which is marked as an abstract method. Python is expecting a concrete implementation of this method. Any class that inherits from the Event ABC must have a concrete implementation of this method.
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))
🌐
Medium
leapcell.medium.com › elegant-abstractions-mastering-abstract-base-classes-in-advanced-python-bf3739dd815e
Elegant Abstractions: Mastering ABCs in Advanced Python | by Leapcell | Medium
May 2, 2025 - Use ABC to declare LeapCellFileHandler as an abstract base class. Use the @abstractmethod decorator to mark abstract methods. If you try to instantiate a subclass that has not implemented all abstract methods, Python will raise an exception:
🌐
GeeksforGeeks
geeksforgeeks.org › python › abstract-base-class-abc-in-python
Abstract Base Class (abc) in Python - GeeksforGeeks
July 15, 2025 - It often serves as an alternative to subclassing a built-in Python class. For example, subclassing the MutableSequence can substitute the subclassing of list or str. The main purpose of using Abstract class is that it allows you ...