2004年03月25日 星期四 10:37
Levin:
您好!
这本来就是一个对象成员,不是什么全局变量。应该在构造函数里加入
self.db=DB(storage)
在析构里加入
self.db.close
不要在类声明中直接定义(而非成员函数内)变量,否则应该是视为类成员吧……
WxPython Framework应该有类似构造和析构的初始化以及清理函数。
======= 2004-03-25 10:34:55 您在来信中写道:=======
>要用全局变量,最好使用前先声明一下
>
>将
>
>global db
>
>加入方法首部
>
>Nature.Liu wrote:
>
>> Dear Zoom.Quiet:
>> 谢谢
>> self.db=DB(storage)是可行的,
>> 但self.db.close好像还是无效
>>
>>
>>
>
>_______________________________________________
>python-chinese list
>python-chinese at lists.python.cn
>http://python.cn/mailman/listinfo/python-chinese
>.
= = = = = = = = = = = = = = = = = = = =
致
礼!
刘鑫
liux at gdcn.com
2004-03-25
Zeuux © 2025
京ICP备05028076号