Re: beginner's refcount questions

2006-10-30 Thread Scott David Daniels
Jens Theisen wrote: > python uses gc only where refcounts alone haven't yet done the > job. Thus, the following code > class Foo: > def __del__(self): >print "deled!" ... In c++, this is a central technique used for all sorts of tasks, whereas in garbage collected languages

Re: beginner's refcount questions

2006-10-29 Thread Fredrik Lundh
Jens Theisen wrote: > Thus, the following code > > class Foo: > def __del__(self): > print "deled!" > > def foo(): > f = Foo() > > foo() > print "done!" > > prints > > deled! > done! > > and not the other way round. the behaviour you see in this simple program is not guarant

Re: beginner's refcount questions

2006-10-29 Thread Terry Reedy
"Jens Theisen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > python uses gc only where refcounts alone haven't yet done the > job. /python/The CPython implementation/ > And some other minor question: Is there a way to query the use count > of an object? This would be useful for

Re: beginner's refcount questions

2006-10-29 Thread Jean-Paul Calderone
On 30 Oct 2006 00:30:53 +, Jens Theisen <[EMAIL PROTECTED]> wrote: >Hello, > >python uses gc only where refcounts alone haven't yet done the >job. Thus, the following code > >class Foo: >def __del__(self): >print "deled!" > >def foo(): >f = Foo() > >foo() >print "done!" > >print

beginner's refcount questions

2006-10-29 Thread Jens Theisen
Hello, python uses gc only where refcounts alone haven't yet done the job. Thus, the following code class Foo: def __del__(self): print "deled!" def foo(): f = Foo() foo() print "done!" prints deled! done! and not the other way round. In c++, this is a central technique used