Constructor Overloading in Python: Python 3.8 and Afterwards

adil
Dec 4, 2021

--

Did you know that since 3.8 you can overload the constructor method in Python?

Thanks to @functools.singledispatchmethod you can overload the constructor method

When I run the code in Python 3.8 I get this output:

BIOS *** Power supply
dict_items([('CPU', '3.0GHz'), ('RAM', '32GB')])
CPU - RAM - SSD
Motherboard
99999

An alternative approach:

Another alternative approach:

--

--