More than once, I've had bugs that were hard to track down because I was 
accidentally using an implicit namespace without realizing it.

The last time this happened, it was a typo, and my init file was named 
`_init__.py` instead of `__init__.py`. The init file imported from sub-modules, 
including 1 with a class that was supposed be be registered via an 
`__init_subclass__` callback that was not happening.

I'm sure that implicit namespace packages are here to stay, and I imagine I 
will actually want to use them on purpose at some point, but it would be nice 
if we could come up with a straightforward way to avoid the accidental usages.

One idea that comes to mind is to add a new built-in context manager within 
which the importing of a purely implicit namespace raises an exception.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/V7QU3IDGKITJ3J4FL7G6YAFKIXM44IC2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to