I suppose you could change the signature to
```
__init__(self, filename=None, dim=None)
```
and then test for that further down rather than counting the number of arguments. I think that would be more readable.