Re: conditional import into global namespace

2010-03-03 Thread Diez B. Roggisch
Am 02.03.10 21:41, schrieb mk: Jerry Hill wrote: Just import subprocess at the top of your module. If subprocess hasn't been imported yet, it will be imported when your module is loaded. If it's already been imported, your module will use the cached version that's already been imported. In

conditional import into global namespace

2010-03-02 Thread mk
Hello everyone, I have a class that is dependent on subprocess functionality. I would like to make it self-contained in the sense that it would import subprocess if it's not imported yet. What is the best way to proceed with this? I see a few possibilities: 1. do a class level import,

Re: conditional import into global namespace

2010-03-02 Thread MRAB
mk wrote: Hello everyone, I have a class that is dependent on subprocess functionality. I would like to make it self-contained in the sense that it would import subprocess if it's not imported yet. What is the best way to proceed with this? I see a few possibilities: 1. do a class level

Re: conditional import into global namespace

2010-03-02 Thread Jerry Hill
On Tue, Mar 2, 2010 at 12:46 PM, mk mrk...@gmail.com wrote: Hello everyone, I have a class that is dependent on subprocess functionality. I would like to make it self-contained in the sense that it would import subprocess if it's not imported yet. What is the best way to proceed with this?

Re: conditional import into global namespace

2010-03-02 Thread mk
Jerry Hill wrote: Just import subprocess at the top of your module. If subprocess hasn't been imported yet, it will be imported when your module is loaded. If it's already been imported, your module will use the cached version that's already been imported. In other words, it sounds like

Re: import and global namespace

2006-07-12 Thread Bruno Desthuilliers
Dennis Lee Bieber wrote: On Wed, 12 Jul 2006 02:48:44 +0200, Bruno Desthuilliers [EMAIL PROTECTED] declaimed the following in comp.lang.python: nate a écrit : I'd like a module than I'm importing to be able to use objects in the global namespace into which it's been imported. is there a

import and global namespace

2006-07-11 Thread nate
I'd like a module than I'm importing to be able to use objects in the global namespace into which it's been imported. is there a way to do that? thanks, nate -- http://mail.python.org/mailman/listinfo/python-list

Re: import and global namespace

2006-07-11 Thread Bruno Desthuilliers
nate a écrit : I'd like a module than I'm importing to be able to use objects in the global namespace into which it's been imported. is there a way to do that? It's a very bad idea. Instead of asking how to implement a bad solution, tell us about the real problem. NB : FWIW, the clean