Ralf Schoenian <ralf@schoenian-online.de> wrote:
> in a rather large python project, more than 50.000 loc, but no wxPython
> involved, I have put any import statements that I need in any file into
> a single file. For example os, sys, config, our Time class, and so on.
> It helped me to keep the overview, but memory consumption is no matter.
> A module will be imported only once.
----
I cann't agree more with Josiah. It is not only a bad style, it is
also anti-pythonic and denotes a wrong comprehension of Python.
Modules are imported only once. There is no time penalty with builtin
modules like os, sys or string.
I also have "large" applications. How many lines? I do not know and I do
not care. What I know is that, when I need a module, I imported it. This
gives me a good overview. It also allows me to test the modules seperatly.
@Ralf Schoenian
So, if I want to test/improve one of your modules, I should have them all.
I hope you see this as a non sense.
> in a rather large python project, more than 50.000 loc, but no wxPython
> involved, I have put any import statements that I need in any file into
> a single file. For example os, sys, config, our Time class, and so on.
> It helped me to keep the overview, but memory consumption is no matter.
> A module will be imported only once.
From a style perspective, that isn't good.
- Josiah
----
I cann't agree more with Josiah. It is not only a bad style, it is
also anti-pythonic and denotes a wrong comprehension of Python.
Modules are imported only once. There is no time penalty with builtin
modules like os, sys or string.
I also have "large" applications. How many lines? I do not know and I do
not care. What I know is that, when I need a module, I imported it. This
gives me a good overview. It also allows me to test the modules seperatly.
@Ralf Schoenian
So, if I want to test/improve one of your modules, I should have them all.
I hope you see this as a non sense.
Sorry for my bad english.I have put it wrong. Of course, we do not import all the modules in one single file. We also import the modules where we need them but the configuration and other very very basic modules that we need in all other modules. When we started the project we did not know anything about oop but always thought that it is a good idea to do things only ones. I will post that little module tomorrow morning. I would be pleased if you could give me some advice and tell me how I can do this imports in a better way. Many thanks in advance.