# Variable type returned after integrating.

If I have an expression and I integrate it, the type of object that is returned is not constant.

```
> x = var('x')
> type((x**2).integral(x))
<type 'sage.symbolic.expression.Expression'>
> type((0*x).integral(x))
<type 'sage.rings.integer.Integer'>
```

This makes it quite hard to write functions that do things with Expressions. Is there some trick I'm missing to get around this?

An example of where this causes a problem:

```
> ff = Piecewise([[(-Infinity, -1), 0*x], [(-1, 1), x**0], [(1, Infinity), 0*x]], x)
> ff.integral(x, -1.0, 1.0)
Traceback (click to the left of this block for traceback)
...
AttributeError: 'sage.rings.integer.Integer' object has no attribute 'function'
```