On Sun, Aug 24, 2008 at 2:27 PM, alex23 <[EMAIL PROTECTED]> wrote: > On Aug 24, 8:34 pm, "Mohamed Yousef" <[EMAIL PROTECTED]> wrote: >> and sys ,string.. etc add them all twice or four / n times ? >> remove one and then forget to remove one of them in a file and start >> debugging ... this really doesn't look to be a good practice > > No, having each module contain all of the necessary imports for itself > -is- good practice. > > While it might seem more convenient to define all of your imports in > one place, what you're really doing is injecting -all- references to - > all- imported items into -every- module. Having a global soup of > imported items like such is much, much harder to control for > unexpected name conflicts. > > Ideally, you want each module's namespace to -only- contain references > to the external entities it's actually using. This not only makes each > module self-contained and more open to independent re-use, it makes > them -incredibly- easier to debug. > > Please don't confuse temporary convenience with good practice. mm , this seems to be logically or another good behind logic . as PHP already uses that convention -from which i thought python also does -
but what about module-wide variables what is the approach to them , will i have to store them in a memory table (SQL) , or keep passing them between objects - which i really hate - -- http://mail.python.org/mailman/listinfo/python-list