аватар question@mail.ru · 01.01.1970 03:00

Several designers with different amounts of arguments

Is it possible to make several designers with different amounts of arguments in Python in one class?

   class   a :   def   __ init __  ( self, b ):   pass    def   __ Init __  ( self ):   pass   

in this case, you can create a class of class only with the second constector, while the recording x = a (42) will cause an error.

аватар answer@mail.ru · 01.01.1970 03:00

to be short, then no.

look in more detail the discussion here. There are also solution options for the use of optional or key arguments.

Latest

Similar