useless destructors

M

Marcin 'Qrczak' Kowalczyk

Further to the discussion from earlier titled "does python have
useless destructors?", I've posted a brief summary of garbage
collection, RAII, and the "using" clause (which is what PEP310's
"with" clause amounts to). The post is here:

http://dkturner.blogspot.com/2004/06/garbage-collection-raii-and-using.html

You left "for later" a point which makes the last proposition unworkable:
how to implement selective refcounting in a dynamically typed language?
Will it still work if the refcounted object is referred to from a plain
object? The only way I can imagine is to manage refcounts on each object
passing, returning and rebinding.
 
R

Roy Smith

Marcin 'Qrczak' Kowalczyk said:
You left "for later" a point which makes the last proposition unworkable:
how to implement selective refcounting in a dynamically typed language?
Will it still work if the refcounted object is referred to from a plain
object? The only way I can imagine is to manage refcounts on each object
passing, returning and rebinding.

Well, you could take a page from perl, and "taint" refcounted objects.
Any time you make a reference to an object, if the referenced object is
refcounted, the referrer becomes refcounted too.

The next question is, would this in practice end up refcounting most
objects? If so, that would sort of defeat the purpose.
 
D

David Turner

Marcin 'Qrczak' Kowalczyk said:
You left "for later" a point which makes the last proposition unworkable:
how to implement selective refcounting in a dynamically typed language?
Will it still work if the refcounted object is referred to from a plain
object? The only way I can imagine is to manage refcounts on each object
passing, returning and rebinding.

To answer your second question first: no, of course it won't -- the
contained object will be destroyed only when the container is garbage
collected. But of course, that's the behaviour you'd expect. I don't
see it as a serious concern.

Your first point is well made. I agree that it would be extremely
difficult to implement deterministic destruction in Python. As you've
pointed out before, the overhead is considerable on some significant
platforms, and worst of all, it's not limited to cases where
deterministic destruction is used (although I still believe that the
additional overhead for other objects should be pretty minor).

Regards
David Turner
 
A

Aahz

Further to the discussion from earlier titled "does python have
useless destructors?", I've posted a brief summary of garbage
collection, RAII, and the "using" clause (which is what PEP310's
"with" clause amounts to). The post is here:

http://dkturner.blogspot.com/2004/06/garbage-collection-raii-and-using.html

Finally had a chance to try this, and you're using a webserver that
barfs with Lynx. That makes me completely uninterested in anything
you've got to say.
 
T

Troy Melhase

Finally had a chance to try this, and you're using a webserver that
barfs with Lynx. That makes me completely uninterested in anything
you've got to say.

Why do you even bother to defend your browsing preferences like this? You're
in the hopeless minority, and you do neither David nor yourself any good by
being rude. I don't care about your browser preference, or why you choose
not to visit some sites -- just as I don't care for your attitude towards
others.

Put another way: Would it be so hard to simply ask for the site in reasonable
HTML? Or to simply ignore it?

Put a third way: This list is for the discussion on the use of the python
language. The group you want is alt.opensource.community.badexample.
 
O

Oliver Fromme

Aahz said:
>
> Finally had a chance to try this, and you're using a webserver that
> barfs with Lynx.

FWIW, it doesn't work with _any_ browser that I've tried
(links, elinks, w3m, dillo, opera, and a self-written one).
HEAD requests do work (and indicate it's an Apache server,
unless the server signature is faked), but GET requests do
not. There's probably something seriously broken with that
web server.

Best regards
Oliver

PS: I didn't bother to try lynx, because it is the least
useful browser anyway. :) Actually I'm surprised that
there are still people who insist on using it, since there
are better alternatives such as links or w3m.
 
A

Aahz

PS: I didn't bother to try lynx, because it is the least useful
browser anyway. :) Actually I'm surprised that there are still people
who insist on using it, since there are better alternatives such as
links or w3m.

They work better as browsers, technically, but their keyboard operations
are much poorer.
 
O

Oliver Fromme

Aahz said:
>
> They work better as browsers, technically, but their keyboard operations
> are much poorer.

Can you be a little more specific, please?

The keyboard navigation of links particularly mimics that
of lynx pretty closely, as far as I can tell. However, I
agree that the navigation in w3m is somewhat different
(but it has its advantages, too, once you get used to it).

Well, it's all a matter of taste, I guess.

Best regards
Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,191
Latest member
BuyKetoBeez

Latest Threads

Top