I wanted to receive an unknown number of instances at once and handle members.
ObjList.py
class object:
def __init__(self, value):
self.L = value
def integral(ObjList):
L = 0.0
for obj in ObjList:
L += obj.L
return L
def main():
obj1 = object(2.0)
obj2 = object(3.0)
L = integral([obj1, obj2])
print(L)
if __name__ == '__main__':
main()
I was able to write it surprisingly neatly. It's supposed to be used for different purposes, but it can be used to implement to-do lists and Gantt charts.
Recommended Posts