Re: Python language problem

2006-06-07 Thread ripley
Thanks all, you all are nice man. Dennis Lee Bieber 写道: > while len(lst): #list is a built-in function, don't use as a name > del lst[0] #delete the first item IN the lst > I found Dennis 's code is usefull that is a way to solve my problem. -- http://mail.python.org

Re: Python language problem

2006-06-07 Thread baiju
May be you are looking for weakref module: http://www.python.org/doc/current/lib/module-weakref.html -- Baiju M -- http://mail.python.org/mailman/listinfo/python-list

Re: Python language problem

2006-06-07 Thread Steve Holden
ripley wrote: > Boris Borcic wrote: > >>[EMAIL PROTECTED] wrote: >> >>class A: >>> >>>... pass >>>... >>> >>a = A() >>b = a >>del b >>a >>> >>><__main__.A instance at 0x00B91BC0> >>>I want to delete 'a' through 'b', why It does't? >>>How can I do that? >> >>del a,b > > > Bu

Re: Python language problem

2006-06-07 Thread Diez B. Roggisch
> > Thanks for your so detailed explain, I think I know you, But my Engish > is not enough > to explain. > > I create same object in Tree, I want to update Tree, when I need to > delete subtree. > If where no references, I can't do that. some thing like blow: > for i in list: >del i This ma

Re: Python language problem

2006-06-07 Thread ripley
Laszlo Nagy wrote: > You must undestand that 'a' and 'b' are names. You can only delete > names, not objects. Objects are freed by the garbage collector, > automatically. Probably you used to write programs in C or Pascal or > other languages with pointers. In Python, there are no pointers, just >

Re: Python language problem

2006-06-07 Thread ripley
Boris Borcic wrote: > [EMAIL PROTECTED] wrote: > class A: > > ... pass > > ... > a = A() > b = a > del b > a > > <__main__.A instance at 0x00B91BC0> > > I want to delete 'a' through 'b', why It does't? > > How can I do that? > > del a,b But 'b' is also deleted, i want u

Re: Python language problem

2006-06-07 Thread Laszlo Nagy
[EMAIL PROTECTED] i'rta: class A: > ... pass > ... > a = A() b = a del b a > <__main__.A instance at 0x00B91BC0> > I want to delete 'a' through 'b', why It does't? > How can I do that? > > You must undestand that 'a' and 'b' are names. Y

Re: Python language problem

2006-06-07 Thread Boris Borcic
[EMAIL PROTECTED] wrote: class A: > ... pass > ... a = A() b = a del b a > <__main__.A instance at 0x00B91BC0> > I want to delete 'a' through 'b', why It does't? > How can I do that? del a,b -- http://mail.python.org/mailman/listinfo/python-list