PyCA.Core imported into other submodules
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)
-
-
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.
-
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 :-).
-
reporter - changed status to resolved
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>>
-
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>>
- Log in to comment
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 viaPyCA.Core.*
?