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
Lie Ryan lie.1...@gmail.com 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
On Feb 3, 1:37 pm, Ray rayky...@gmail.com 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
Hi Lie,
On Feb 3, 7:21 pm, Lie lie.1...@gmail.com wrote:
On Feb 3, 1:37 pm, Ray rayky...@gmail.com 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
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
Hi Stephen,
On Feb 4, 1:08 pm, Stephen Hansen apt.shan...@gmail.com 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
On Mon, Feb 2, 2009 at 1:58 PM, Stephen Hansen apt.shan...@gmail.comwrote:
On Sun, Feb 1, 2009 at 11:43 PM, Taskinoor Hasan
taskinoor.ha...@csebuet.org 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
Hi Stephen and everyone,
On Feb 2, 4:36 pm, Stephen Hansen apt.shan...@gmail.com 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
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
2009 23:19:09 -0800
Subject: Re: Import without executing module
On Sun, Feb 1, 2009 at 11:05 PM, Ray rayky...@gmail.com 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
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
Hi all,
On Feb 3, 1:11 am, John Machin sjmac...@lexicon.net 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
Hi all,
I'm quite new to python as I've only just started to learn about it a
few days ago... I am trying to do something and after reading about
it, I'm still not sure whether or not it can be done.
Basically, someone has created a python script and I would like to
make use of his functions.
On Sun, Feb 1, 2009 at 11:05 PM, Ray rayky...@gmail.com 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
On Feb 2, 12:19 pm, Stephen Hansen apt.shan...@gmail.com wrote:
On Sun, Feb 1, 2009 at 11:05 PM, Ray rayky...@gmail.com 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
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
--
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 apt.shan...@gmail.comwrote:
Maybe he can wrap the things he
On Sun, Feb 1, 2009 at 11:43 PM, Taskinoor Hasan
taskinoor.ha...@csebuet.org 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
18 matches
Mail list logo