3 ms·
There's also the thing where you used to need to have a magic __init__.py file for a folder to be a considered as a module, but now it's optional, although I st
by earthboundkid 7y ago
There's also the thing where you used to need to have a magic __init__.py file for a folder to be a considered as a module, but now it's optional, although I still have no idea what the formula is for when Python decides something is a module…
- globular-toast 7y agoIt's not really optional. There's just this new thing called namespace packages which is not quite the same. I don't fully understand what it's for yet.
- greenshackle2 7y agoNamespace packages let you ship `foo.bar` and `foo.baz` separately. `bar` and `baz` are really two separate packages that are both part of the `foo` namespace. `foo` is not a real package. They are not new but implicit namespace packages are new-ish. Before 3.3 it was more complicated to set up, now you just omit __init__.py from `foo`. I don't see any reason to use this if `foo` is shipped as a single package.
- j88439h84 7y agoThis is right.
- earthboundkid 7y agoIf the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea.