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 - 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 ...
🌐
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.
🌐
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 - The ‘abc’ module in the Python library provides the infrastructure for defining custom abstract base classes.
🌐
PyPI
pypi.org › project › python-abc
python-abc · PyPI
A python implementation of the ABC Software metric
      » pip install python-abc
    
Published   Jan 02, 2026
Version   0.3.0
🌐
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
Find elsewhere
🌐
GitConnected
levelup.gitconnected.com › exploring-pythons-abstract-base-classes-abc-patterns-and-use-cases-7489bba66a7e
Exploring Python’s Abstract Base Classes (ABC): Patterns and Use Cases | by Aman Kardam (PhD) | Level Up Coding
August 13, 2025 - Abstract Base Classes make it easy to set up common patterns for classes, ensuring that any class that inherits from an ABC has the required methods and properties. In this guide, I’ll share what I’ve learned about Python’s ABCs, why they’re ...
🌐
W3Schools
w3schools.com › python › ref_module_abc.asp
Python abc Module
Getting Started Mean Median Mode Standard Deviation Percentile Data Distribution Normal Data Distribution Scatter Plot Linear Regression Polynomial Regression Multiple Regression Scale Train/Test Decision Tree Confusion Matrix Hierarchical Clustering Logistic Regression Grid Search Categorical Data K-means Bootstrap Aggregation Cross Validation AUC - ROC Curve K-nearest neighbors · Python DSA Lists and Arrays Stacks Queues Linked Lists Hash Tables Trees Binary Trees Binary Search Trees AVL Trees Graphs Linear Search Binary Search Bubble Sort Selection Sort Insertion Sort Quick Sort Counting Sort Radix Sort Merge Sort
🌐
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 - I tried it in gcc and g++. Both gives ‘increasing’ without any warning. Thanks John. ... It is likely that clang compiler will give a warning. ... In Python, and in some other languages, the expression a < b < c is equivalent to a < b and b < c …with the difference that b is evaluated once.
🌐
Real Python
realpython.com › ref › stdlib › abc
abc | Python Standard Library – Real Python
The Python abc module provides infrastructure for defining abstract base classes (ABCs).
🌐
GeeksforGeeks
geeksforgeeks.org › python › abstract-base-class-abc-in-python
Abstract Base Class (abc) in Python - GeeksforGeeks
July 15, 2025 - The main goal of the abstract base class is to provide a standardized way to test whether an object adheres to a given specification. It can also prevent any attempt to instantiate a subclass that doesn't override a particular method in the ...
🌐
k0nze
k0nze.dev › posts › python-interfaces-abstract-classes
Python’s Abstract Base Classes (ABC) and Interfaces Explained (With Code Snippets) | k0nze
February 22, 2024 - In this article, you will learn what interfaces and abstract classes are and how to use Python’s ABC module to use those two concepts in your Python code. In general terms, an interface is the definition of the inputs and outputs of a thing. For example, the common inputs and outputs of water ...
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))
Top answer
1 of 8
15

There are no pointers to variables in Python. In particular, when you say this:

Is the statement replacing the pointer c -> a with pointer c -> b...

Python does not have any such thing as "the pointer c -> a", so it is not doing that.

...or grabbing the value from b and overwriting a with b's value

but there is no assignment to a, so it's not doing that either.

Instead, Python keeps a symbol table1 that maps each name (a, b, c, etc.) to a pointer to an object. In your code sample, after you assign to a and b, it would look like this (obviously I have made up the memory addresses):

a -> 0xfffa9600 -> 1
b -> 0xfffa9608 -> 2

and then after you assign c = a, it would look like this:

a -> 0xfffa9600 -> 1
b -> 0xfffa9608 -> 2
c -> 0xfffa9600 -> 1

Note that c is entirely independent of a. When you run c = b, it replaces the pointer associated with c in the symbol table with the pointer that was associated with b, but a is not affected:

a -> 0xfffa9600 -> 1
b -> 0xfffa9608 -> 2
c -> 0xfffa9608 -> 2

In this case that's pretty much all there is to it because the objects in question, namely the integer constants 1 and 2, are immutable. However, if you use mutable objects, they do start to act a bit more like pointers in the sense that changes to the object when it's stored in one variable are reflected in other variables that refer to the same object. For example, consider this sample of code:

x = {'a': 1, 'b': 2}
y = x

Here, the symbol table might look something like this:

x -> 0xffdc1040 -> {'a': 1, 'b': 2}
y -> 0xffdc1040 -> {'a': 1, 'b': 2}

If you now run

y['b'] = y['a']

then it doesn't actually change the pointer associated with y in the symbol table, but it does change the object pointed to by that pointer, so you wind up with

x -> 0xffdc1040 -> {'a': 1, 'b': 1}
y -> 0xffdc1040 -> {'a': 1, 'b': 1}

and you'll see that your assignment to y['b'] has affected x as well. Contrast this with

y = {'a': 1, 'b': 2}

which actually makes y point at an entirely different object, and is more akin to what you were doing before with a, b, and c.


1Actually there are several symbol tables, corresponding to different scopes, and Python has an order in which it checks them, but that detail isn't particularly relevant here.

2 of 8
7

c doesn't "Point at a or b"... it points at the 1 or 2 objects.

>>> a = 1
>>> b = 2
>>> c = a
>>> c
1
>>> c = b
>>> c
2
>>> b = 3
>>> c
2

This can be proven somewhat with id() - b and c point at the same "thing":

>>> b = 2
>>> c = b
>>> id(b)
42766656
>>> id(c)
42766656