To be more clear, I would write this and the following code block as something like:

```python
fracs = self.to_atom_frac() if frac_type == 'atom' else self.comp
frac_sign = '' if  frac_type == 'atom' else '-'
for nuc, frac in fracs.items():
    if 'table_ids' in self.attrs:
        s += '     {0}.{1} '.format(str(nuc)[:-1], self.attrs['table_ids'][str(nuc)])
    else:
        s += '     {0} '.format(nuc)
    s += '{0}{1:.4E}\n'.format(frac_sign, frac)
```

This has the advantage of evaluating fewer conditionals inside of the loop.