PyCA.Core imported into other submodules

Issue #1 resolved
Sam Preston created an issue

The code in PyCA submodules (PyCA.Common, PyCA.Display, etc.) rely on PyCA.Core, and import it as 'from PyCore import *', so all core definitions and up duplicated in each other submodule. This makes it difficult to see what's available in the submodule in ipython.

Comments (5)

  1. Jacob Hinkle

    Do you think the submodules should import as import PyCA.Core instead? If a submodule does this then does the user need to call everything via PyCA.Core.*?

  2. Sam Preston reporter

    (Reply via js...@sci.utah.edu):

    Doing something like 'import PyCA.Core as core' and then prefixing all the calls with 'core.' would fix it. My preference for user scripts is to dump the core module into the current context, but prefixing for the submodules wouldn't be too bad, just a little ugly imo.

  3. Jacob Hinkle

    I agree wrt submodules needing their own prefixes. Is it possible to import all submodules into a common namespace? For instance, is it possible to do something like

    import PyCA.* as ca
    

    and have that flatten all the submodules so we could just write ca.Sum() for instance?

    PS- Looks like bitbucket expands usernames that start with @ symbol :-).

  4. Sam Preston reporter

    modified submodule python code so that contents of PyCA.Core are not imported into the submodule namespace (replaced 'from PyCA.core import *' with 'import PyCA.Core as core' and prefixing calls with 'core.'). This closes issue #1.

    → <<cset 1ef1381761e2>>

  5. Jacob Hinkle

    modified submodule python code so that contents of PyCA.Core are not imported into the submodule namespace (replaced 'from PyCA.core import *' with 'import PyCA.Core as core' and prefixing calls with 'core.'). This closes issue #1.

    → <<cset 488b489306c6>>

  6. Log in to comment