On Wed, Sep 21, 2016 at 11:14 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > Peng Yu <pengyu...@gmail.com> writes: > >> I want to import all the thing (or the ones available in the >> respective __all__) defined in each of the file by putting the >> following lines in __init__.py >> >> from file1 import * >> .... >> from filen import * >> >> However, I don't want to hardcode the file names in __init__.py. Is >> there an automatic way of doing it? > > Why do you want to do that? It will defeat static analysis of the code, > which is one of the more important tools to make your code reliable. > > It will also make the names in the code impossible to automatically > match against where they came from. Explicit is better than implicit; > you are proposing to make an unknown horde of names in the code implicit > and untraceable. > > Why? What problem are you trying to solve that you believe needs this > approach?
This will make refactoring easy. If everything is explicit, when one do refactoring, at two places need to be changed which can be a burden. -- Regards, Peng -- https://mail.python.org/mailman/listinfo/python-list