```
def checkerboard(shape):
return np.indices(shape).sum(axis=0) % 2
```

Most compact, probably the fastest, and also the only solution posted that generalizes to n-dimensions.

```
def checkerboard(shape):
return np.indices(shape).sum(axis=0) % 2
```

Most compact, probably the fastest, and also the only solution posted that generalizes to n-dimensions.