What about something like:

```
d = {}
ints = ['N','dtype','nw']
for spec,value in zip("N ap beam dtype w1 dw nw z aplow aphigh".split(), spec.split()):
     if spec in ints:
        d[spec]=int(value)
     else:
          d[spec]=float(value)
```

or something along those lines?  Honestly, what you have isn't a problem, but a series of `pop` commands does feel a little dirty.  `zip` automatically truncates, btw.