@keflavich and @andycasey suggested the following:

This might just be semantics (sorry if it is), but this part was a little hard for me to follow. Maybe something like:

    N, ap, beam, dtype, w1, dw, nw, z, aplow, aphigh = spec.split()
    N, dtype, nw = map(int, [N, dtype, nw])
    w1, dw, z, aplow, aphigh = map(float, [w1, dw, z, aplow, aphigh])

The problem is that I don't know in advance what I am going to find in spec. Depending on the encoding (non, linea,r log-lin, polynom, spline and then degree of polynom, degree of spline) it may have a different number of elements. It could even be that I read all the coefficients for a 6th order chebychev polynom and then find stuff for a cubic spline after that (in that case the results form both functions would be added to each other). 
In other words, not even the number of functions to be evaluated, let alone the number of coefficients is know in advance. That's why that is a `while len(spec) > 0` loop and that's why I need to peel of the coefficient one bot one.

    N, ap, beam, dtype, w1, dw, nw, z, aplow, aphigh = spec.split()

would simple give 

    ValueError: too many values to unpack

All I could do is

    specstart = spec[0:10]
    specend = spec[10:]
    N, ap, beam, dtype, w1, dw, nw, z, aplow, aphigh = specstart.split()
    N, dtype, nw = map(int, [N, dtype, nw])
    w1, dw, z, aplow, aphigh = map(float, [w1, dw, z, aplow, aphigh])

but that saves only 4 lines of code. If you compare my code to http://iraf.net/irafdocs/specwcs.php you will see that it closely follows the format specification there. I would prefer to keep it this way (but I no strong feelings if you insist on the change).