you can also do:

```python
dof = y.size - (2 if center else 1)
```

BTW, I would rather name the variable `degrees_of_freedom` to be more explicit.