You can just allow the dummy to be passed in as an argument, like

```
def invert(eq, x, y=None):
    y = y or Dummy('y')
```