Defining Multiple Constructors in Python

Veröffentlicht am: 13 Oktober 2022
auf dem Kanal: 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


Auf dieser Seite können Sie das Online-Video Defining Multiple Constructors in Python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Real Python 13 Oktober 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 2,831 Mal angesehen und es wurde von 68 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!