Constructor Overloading in Python: Python 3.8 and Afterwards

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:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store