ery...@gmail.com 在 2022年9月2日 星期五凌晨12:41:46 [UTC+8] 的信中寫道:
> On 8/31/22, Jach Feng wrote:
> >
> > I found that using "from test import *" in test2.py makes test2's relation
> > to "test" almost like the function's relation to the module where it is
> > defined. You can refer to all the variable
On 8/31/22, Jach Feng wrote:
>
> I found that using "from test import *" in test2.py makes test2's relation
> to "test" almost like the function's relation to the module where it is
> defined. You can refer to all the variables of the module
Note that in general, if __all__ doesn't exist to expli
Mark Bourne 在 2022年9月1日 星期四凌晨2:43:40 [UTC+8] 的信中寫道:
> Jach Feng wrote:
> > Mark Bourne 在 2022年8月29日 星期一下午6:40:59 [UTC+8] 的信中寫道:
> >> Jach Feng wrote:
> >>> Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道:
> On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote:
> >
> > Richard Da
Jach Feng wrote:
Mark Bourne 在 2022年8月29日 星期一下午6:40:59 [UTC+8] 的信中寫道:
Jach Feng wrote:
Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道:
On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote:
Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道:
On 8/27/22 7:42 AM, Mark Bourne wrote:
Jach
Op 31/08/2022 om 09:53 schreef dn:
On 31/08/2022 19.38, Antoon Pardon wrote:
Op 30/08/2022 om 23:52 schreef dn:
The conversation seems to be wandering some way from the OP. Whereas
both of these answers are clever (and I assume work), the question
becomes: why would you want to do this? (esp
On 31/08/2022 19.38, Antoon Pardon wrote:
>
>
> Op 30/08/2022 om 23:52 schreef dn:
>> The conversation seems to be wandering some way from the OP. Whereas
>> both of these answers are clever (and I assume work), the question
>> becomes: why would you want to do this? (especially as it looks ugly
Op 30/08/2022 om 23:52 schreef dn:
The conversation seems to be wandering some way from the OP. Whereas
both of these answers are clever (and I assume work), the question
becomes: why would you want to do this? (especially as it looks ugly and
'smells' a bit convoluted). An example use-case fr
same
> things we want to be global.
>
> Joseph S.
>
> Teledyne Confidential; Commercially Sensitive Business Data
>
> -Original Message-
> From: Stefan Ram
> Sent: Tuesday, August 30, 2022 1:09 AM
> To: python-list@python.org
> Subject: Re: How t
Ram
Sent: Tuesday, August 30, 2022 1:09 AM
To: python-list@python.org
Subject: Re: How to make a variable's late binding crosses the module boundary?
dn writes:
>Build module.py as:
>***
>CONSTANT = 1
>def func():
>pass
>***
>then in the terminal:
>***
>Python
On 30/08/2022 06.45, Peter J. Holzer wrote:
> The module is imported but it isn't bound to any name in the current
> (global) namespace (obviously there must be some variable bound to it, but
> that's probably a local variable in the importer and it isn't called
> `x`). Then the object bound to th
Mark Bourne 在 2022年8月29日 星期一下午6:40:59 [UTC+8] 的信中寫道:
> Jach Feng wrote:
> > Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道:
> >> On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote:
> >>>
> >>> Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道:
> On 8/27/22 7:42 AM, Mark Bourne wr
On 2022-08-29 11:40:33 +0100, Mark Bourne wrote:
> Jach Feng wrote:
> > Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道:
> > > On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote:
> > > > Sometimes I am wondering why "from x import y" hides x?
> > > > hum...can't figure out the reason:-)
> > > >
On Tue, 30 Aug 2022 at 02:38, Jach Feng wrote:
>
> Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道:
> > On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote:
> > >
> > > Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道:
> > > > On 8/27/22 7:42 AM, Mark Bourne wrote:
> > > > > Jach Feng wrot
Jach Feng wrote:
Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道:
On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote:
Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道:
On 8/27/22 7:42 AM, Mark Bourne wrote:
Jach Feng wrote:
I have two files: test.py and test2.py
--test.py--
x = 2
d
Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道:
> On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote:
> >
> > Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道:
> > > On 8/27/22 7:42 AM, Mark Bourne wrote:
> > > > Jach Feng wrote:
> > > >> I have two files: test.py and test2.py
> > >
On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote:
>
> Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道:
> > On 8/27/22 7:42 AM, Mark Bourne wrote:
> > > Jach Feng wrote:
> > >> I have two files: test.py and test2.py
> > >> --test.py--
> > >> x = 2
> > >> def foo():
> > >> print(x)
> > >> f
Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道:
> On 8/27/22 7:42 AM, Mark Bourne wrote:
> > Jach Feng wrote:
> >> I have two files: test.py and test2.py
> >> --test.py--
> >> x = 2
> >> def foo():
> >> print(x)
> >> foo()
> >>
> >> x = 3
> >> foo()
> >>
> >> --test2.py--
On 8/27/22 7:42 AM, Mark Bourne wrote:
Jach Feng wrote:
I have two files: test.py and test2.py
--test.py--
x = 2
def foo():
print(x)
foo()
x = 3
foo()
--test2.py--
from test import *
x = 4
foo()
-
Run test.py under Winows8.1, I get the expected result:
e:\MyDocument>py test.py
2
3
B
Mark Bourne 在 2022年8月27日 星期六晚上7:42:37 [UTC+8] 的信中寫道:
> import test
> test.x = 4
> test.foo()
>
> --
> Mark.
Yes, you are right. But because of I am using "from test import *" which makes
the name "test" disappear in the test2 scope, so this is not work.
I solved this problem by moving "x" to
Jach Feng wrote:
I have two files: test.py and test2.py
--test.py--
x = 2
def foo():
print(x)
foo()
x = 3
foo()
--test2.py--
from test import *
x = 4
foo()
-
Run test.py under Winows8.1, I get the expected result:
e:\MyDocument>py test.py
2
3
But when run test2.py, the result is not
20 matches
Mail list logo