Python function return none but it shouldn't
I have a Python function (in a Kalman filter found somewhere) that I debugged with tons of print and it seems to works well.
The print before the return statement shows that the value is OK:
def step(self, z): #----code---- #----alghoritm--- print("self.x that I'm returning:", self.x) # The printed value is [-163.53868766 -160.27005497] so it is OK return self.x print("UNREACHED CODE") # OK, it is not printed
The function that called this is:
print("I call step with", tvec, tvec) # Values are OK estimate = self.kalfilt_trasl_x_y.step((tvec, tvec)) # The returned value is none print("returned value: ", estimate) # Is none
finally found the problem. You're right the problem was in another part of the code. This problem was born since i reused a code intended for other without touching. it was useful ipdb for debugging line by line.