Say you have functions A, B, and C. A will be called and then call B then B calls C. C loops on a bunch of stuff. C determines there is a warning that the user should at least be made aware of but it doesnt block the process. How would you communicate these warnings to A?
If i pass a list to use for warnings from A to B, then its passed straight through to C as B has no use for it. Exceptions would halt C from continuing its loop.
Is this a normal problems? What are elegant ways to solve it?
EDIT: code example
def A():
items = [
[1,2,3],
[4,5,6],
[7,8,9]
]
try:
B(items)
except Exception, e:
print e
def B(items):
for num_list in items:
if len(num_list) == 0:
raise ValueError('A numberlist cannot be emtpy')
C(num_list)
def C(numbers):
for num in numbers:
if num > 9:
## -- Warning???
print '%i is greater than 9, this might break things'
print num