Try/Exception trigger for Angle calculation in Python

58 Views Asked by At

I have a code snippet from another project, and haven't been able to get in touch with the original author to verify some behavior. Within his program, there are a series of try/except statements with respect to angle calculation, and I'm having a hard time getting what condition would trigger an exception (if any). This particular calculation is looped through many times, so if I can avoid testing conditions, I'd like to.

import math

try:
    vec_rox = [math.tan(rox/2.0), 0.0, 0.0]
except:
    vec_rox = [math.tan(math.pi/2.0), 0.0, 0.0]

rox is expected to be a smallish scalar. I'm guessing the except is meant to work if a value error is triggered by the tan evaluation, but I can't find a value that would do so.

0

There are 0 best solutions below