This script finds a vector from a curve. I needed it for orienting a follice to the same direction as the curve’s base, which corresponds to the first two cvs. After writing it, I realized that using edit points (ep) or curve points (u) would give a more accurate direction. Good enough for now, but will rewrite it.
UPDATE: Turns out that I could just use the pymel function
tangent to accomplish the same thing (i.e. finding the tangent at a given point on a curve). For example, to find the tangent at parameter 0, which is the start of the curve, execute