Three dots in Python
#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
Published:
by Lei Ma;
Authors: LM
Table of Contents
Current Ref:
- til/programming/python/python-three-dots.md