Several constructors with different numbers of arguments
📁 Advanced Python Topics
Is it possible to make several constructors with different numbers of arguments in Python in one class?
class a : def __ init __ ( self, b ): pass def __ Init __ ( self ): pass pre> in this case, you can create a class instance only with the second constructor, while the record x = a (42) will cause an error.
No answers yet.
Log in to leave an answer
Blogs