G
Guest
Please see the followed example:
class A:
def __init__(self):
pass
class X:
def __init__(self):
n = 200
if True:
j = 200
m = j
k = A()
print m, j
a = X()
# ?? what about the m, n and j? is it still alive?
del a
--------------------------
In C/C++, the life time of m,n and j was the nearest block. but
obviously, python doen't have this syntax, but I would like to know
that whether the life time of m, n, j is base on function range or
the object range.
We can not access the m, n, and j from the outside of class X. Now I'm
writing a program base on the wxpython. In the __init__ function of
wx.Panel, I use normal varable(just like the m,n and j) created some
widgets. It could be show in the window. Does it indicated the life
time of varable m,n,j is base on the object range?
Sorry for my poor english!
It seems
class A:
def __init__(self):
pass
class X:
def __init__(self):
n = 200
if True:
j = 200
m = j
k = A()
print m, j
a = X()
# ?? what about the m, n and j? is it still alive?
del a
--------------------------
In C/C++, the life time of m,n and j was the nearest block. but
obviously, python doen't have this syntax, but I would like to know
that whether the life time of m, n, j is base on function range or
the object range.
We can not access the m, n, and j from the outside of class X. Now I'm
writing a program base on the wxpython. In the __init__ function of
wx.Panel, I use normal varable(just like the m,n and j) created some
widgets. It could be show in the window. Does it indicated the life
time of varable m,n,j is base on the object range?
Sorry for my poor english!
It seems