New answers tagged python
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 ...
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(...
Top 50 recent answers are included
Related Tags
python × 2033object-oriented × 159
design × 157
design-patterns × 132
python-3.x × 98
django × 84
java × 76
coding-style × 76
architecture × 69
unit-testing × 67
algorithms × 64
object-oriented-design × 60
programming-languages × 58
javascript × 56
c++ × 55
programming-practices × 53
testing × 41
web-applications × 41
web-development × 39
exceptions × 39
php × 37
functions × 35
c × 34
database × 33
api-design × 33