I just meant that if something is very close to, say, 1.5, it would be nice if it were converted too.  So, my suggestion would be to have,
```
if abs(2.*p - round(2.*p)) < 1.e-14):
    p = round(p*2.)/2
    if p == round(p):
        p = int(p)
```
But obviously one could go to town with this. E.g., one could also have right after the test for tuple:
```
# check if power is close to a rational fraction
close_fraction = Fraction(p).limit_denominator(10)
if abs(p-close_fraction) < 1.e-14:
    p = close_fraction
```
(where `10` is rather arbitrary, and where powers of 2 get converted back further down)