Defining Multiple Constructors in Python

Published: 13 October 2022
on channel: Real Python
2,831
68

Sometimes you need to write a Python class that provides multiple ways to construct objects. In other words, you want a class that implements multiple constructors. This kind of class comes in handy when you need to create instances using different types or numbers of arguments.

This is a portion of the complete course, which you can find here:
https://realpython.com/courses/multip...

The rest of the course covers how to:
Checking argument types
Writing multiple constructors using the built-in @classmethod decorator
Overloading your class constructors using the @singledispatchmethod decorator


On this page of the site you can watch the video online Defining Multiple Constructors in Python with a duration of hours minute second in good quality, which was uploaded by the user Real Python 13 October 2022, share the link with friends and acquaintances, this video has already been watched 2,831 times on youtube and it was liked by 68 viewers. Enjoy your viewing!