Three dots in Python

Using three dots in Python:

from abc import abstractmethod

class A:
    def __init__(self):
        self.name = "A"
        print("Init")

    def three_dots(self): ...

    @abstractmethod
    def abs_three_dots(self): ...

    def raise_it(self):
        raise Exception("Not yet done")



a = A()

print("\nthree_dots")
print(a.three_dots())

print("\nabs_three_dots")
print(a.abs_three_dots())

print("\nraise_it")
a.raise_it()

Returns

three_dots
None

abs_three_dots
None

raise_it
Traceback (most recent call last):
  File "main.py", line 27, in <module>
    a.raise_it()
  File "main.py", line 14, in raise_it
    raise Exception("Not yet done")
Exception: Not yet done

Planted: by ;

til/programming/python/python-three-dots Links to:

LM (2020). 'Three dots in Python', Datumorphism, 12 April. Available at: https://datumorphism.leima.is/til/programming/python/python-three-dots/.