Skip to main content

New answers tagged

1 vote
Accepted

How to reduce the number of class instances passed to the __init__() method of a Python class?

The answer by @Caleth shows nicely how to reduce the instance variables in FunctionsManager. To also reduce the argument list when creating a FunctionsManager object, you can turn the creation logic ...
Bart van Ingen Schenau's user avatar
1 vote

How to reduce the number of class instances passed to the __init__() method of a Python class?

It looks like you need a list, not an ever-expanding number of variables. class FunctionsManager: def __init__(self, *instances): self.__instances = instances def handle_received_data(...
Caleth's user avatar
  • 12.4k

Top 50 recent answers are included