Hacker News new | ask | show | jobs
by akubera 2918 days ago
The new importlib.resources[0] module is a nice solution for accessing static data-files within a package/module. It replaces pkg_resources (or perhaps, standardizes/guarantees-presence) and is supposed to be more efficient.

There's also the new module-level "__getattr__(name):" function[1] which behaves as the class method does: catching undefined variable names and providing a way to easily, for example, generate objects dynamically, handle deprecated variables, and lazily load submodules. I have a feeling it's going to be (ab)used to do some really great meta-programming.

[0] https://docs.python.org/3.7/library/importlib.html#module-im... [1] https://www.python.org/dev/peps/pep-0562/