Maybe clearer to say

```python
for ky in (-1, 0 1):
    for kx in (-1, 0, 1):
```