Code:
class AlgDispenser:
# super class to output an algorithm out of a selection of algorithms
def __init__(self, *algorithms: Algorithm):
super().__init__()
self._algs: list[Algorithm] = []
self._activeAlg: int = 0
for i in range(0, len(algorithms)):
self._algs.append(algorithms[i])
def addAlgorithm(self, alg: Algorithm) ->AlgDispenser:
# builder pattern
self._algs.append(alg)
return self
returns an err on ->AlgDispenser:
claiming it is an unresolved reference.
the fix is to add this line at code line 1:
from __future__ import annotations
this enables the builder design pattern in which a method returns it's object