Lie Ryan wrote:
> On Tue, 03 Feb 2009 20:08:34 -0800, Stephen Hansen wrote:
>
> > There is no need to try to make sure something is
> > executed/compiled only once in Python like you may want to do in C.
> > Every module is only ever compiled once: if you import it ten times in
> > ten different
On Tue, 03 Feb 2009 20:08:34 -0800, Stephen Hansen wrote:
> There is no need to try to make sure something is
> executed/compiled only once in Python like you may want to do in C.
> Every module is only ever compiled once: if you import it ten times in
> ten different places only the first will co
Hi Stephen,
On Feb 4, 1:08 pm, Stephen Hansen wrote:
> On Tue, Feb 3, 2009
>
> > So, is inserting the above if statement common practice for python
> > programmers? As a C programmer, it seems that people put a "#ifndef
> > XXX...#define XXX...[all of the code]...#endif" almost as a habit. I
On Tue, Feb 3, 2009
> So, is inserting the above if statement common practice for python
> programmers? As a C programmer, it seems that people put a "#ifndef
> XXX...#define XXX...[all of the code]...#endif" almost as a habit. I
> wonder if its the same thing?
That statement is very common in P
Hi Lie,
On Feb 3, 7:21 pm, Lie wrote:
> On Feb 3, 1:37 pm, Ray wrote:
>
> > I'll enclose the top-level commands with the if statement above...its
> > just a minor change, but it seems unavoidable.
>
> > Thanks again!
>
> > Ray
>
> If you really don't want the file to be changed, you could (dep
On Feb 3, 1:37 pm, Ray wrote:
> I'll enclose the top-level commands with the if statement above...its
> just a minor change, but it seems unavoidable.
>
> Thanks again!
>
> Ray
If you really don't want the file to be changed, you could (depends on
the module) use the module as a subprocess. The i
Hi all,
On Feb 3, 1:11 am, John Machin wrote:
> On Feb 2, 11:51 pm, pyt...@bdurham.com wrote:
>
> > If the output is coming from a print command, couldn't the OP
> > temporarily redirect STDIO to a file to prevent the output from being
> > displayed?
>
> He could, but that'd be a kludge on top
Taskinoor Hasan wrote:
[...]
> It make sense :-). So my reasoning..let A is imported in B, i.e.
> name A is put in B's namespace. When we call something like A.a then the
> interpreter first resolve A in B's namespace, then to get a, it need to
> look up A's namespace. And there is no way to p
On Feb 2, 11:51 pm, pyt...@bdurham.com wrote:
> If the output is coming from a print command, couldn't the OP
> temporarily redirect STDIO to a file to prevent the output from being
> displayed?
He could, but that'd be a kludge on top of a stuff-up. He should put
the script-only statements inside
3:19:09 -0800
Subject: Re: Import without executing module
On Sun, Feb 1, 2009 at 11:05 PM, Ray wrote:
> Basically, someone has created a python script and I would like to
> make use of his functions. I would prefer to not modify his file so
> what I would like to do is just write my script
Hi Stephen and everyone,
On Feb 2, 4:36 pm, Stephen Hansen wrote:
> > Maybe he can wrap the things he dont need inside
> > if __name__ == '__main__':
> > check.
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> Yeah but he said he doesn't want to modify the file itself-- if he c
On Mon, Feb 2, 2009 at 1:58 PM, Stephen Hansen wrote:
> On Sun, Feb 1, 2009 at 11:43 PM, Taskinoor Hasan
> wrote:
> > Can anyone explain what is the necessity of executing whole script when
> > importing. Isn't it enough to just put the module name in the namespace
> and
> > execute when some fun
On Sun, Feb 1, 2009 at 11:43 PM, Taskinoor Hasan
wrote:
> Can anyone explain what is the necessity of executing whole script when
> importing. Isn't it enough to just put the module name in the namespace and
> execute when some function is called?
I'm not sure if I'm going to explain this right--
Can anyone explain what is the necessity of executing whole script when
importing. Isn't it enough to just put the module name in the namespace and
execute when some function is called?
On Mon, Feb 2, 2009 at 1:36 PM, Stephen Hansen wrote:
> > Maybe he can wrap the things he dont need inside
> >
> Maybe he can wrap the things he dont need inside
> if __name__ == '__main__':
> check.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Yeah but he said he doesn't want to modify the file itself-- if he can
modify the file this can all go away readily, yes.
--S
--
http://mail.python
On Feb 2, 12:19 pm, Stephen Hansen wrote:
> On Sun, Feb 1, 2009 at 11:05 PM, Ray wrote:
> > Basically, someone has created a python script and I would like to
> > make use of his functions. I would prefer to not modify his file so
> > what I would like to do is just write my script and import pa
On Sun, Feb 1, 2009 at 11:05 PM, Ray wrote:
> Basically, someone has created a python script and I would like to
> make use of his functions. I would prefer to not modify his file so
> what I would like to do is just write my script and import parts that
> are needed. i.e., I would like to separ
17 matches
Mail list logo