473,779 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

useless destructors

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...and-using.html

Regards
David Turner
Jul 18 '05 #1
9 1643
On Tue, 22 Jun 2004 02:36:24 -0700, David Turner wrote:
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...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.

--
__("< Marcin Kowalczyk
\__/ qr****@knm.org. pl
^^ http://qrnik.knm.org.pl/~qrczak/

Jul 18 '05 #2
In article <pa************ *************** *@knm.org.pl>,
Marcin 'Qrczak' Kowalczyk <qr****@knm.org .pl> wrote:
On Tue, 22 Jun 2004 02:36:24 -0700, David Turner wrote:
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...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.


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.
Jul 18 '05 #3
Marcin 'Qrczak' Kowalczyk <qr****@knm.org .pl> wrote in message news:<pa******* *************** ******@knm.org. pl>...
On Tue, 22 Jun 2004 02:36:24 -0700, David Turner wrote:
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...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.


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
Jul 18 '05 #4
In article <e2************ **************@ posting.google. com>,
David Turner <dk******@telko msa.net> wrote:

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...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.
--
Aahz (aa**@pythoncra ft.com) <*> http://www.pythoncraft.com/

"Typing is cheap. Thinking is expensive." --Roy Smith, c.l.py
Jul 18 '05 #5
On Saturday 03 July 2004 02:20 pm, Aahz wrote:
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.badex ample.
--
Troy Melhase, tr**@gci.net
--
The riddles of God are more satisfying than the solutions of man. - G. K.
Chesterton
Jul 18 '05 #6
Aahz <aa**@pythoncra ft.com> wrote:
David Turner <dk******@telko msa.net> wrote:
http://dkturner.blogspot.com/2004/06...and-using.html


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.

--
Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany

``All that we see or seem is just a dream within a dream.''
(E. A. Poe)
Jul 18 '05 #7
In article <2k************ @uni-berlin.de>,
Oliver Fromme <ol**@haluter.f romme.com> wrote:

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.
--
Aahz (aa**@pythoncra ft.com) <*> http://www.pythoncraft.com/

"Typing is cheap. Thinking is expensive." --Roy Smith, c.l.py
Jul 18 '05 #8
Aahz <aa**@pythoncra ft.com> wrote:
Oliver Fromme <ol**@haluter.f romme.com> wrote:
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.


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

--
Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany

``All that we see or seem is just a dream within a dream.''
(E. A. Poe)
Jul 18 '05 #9
aa**@pythoncraf t.com (Aahz) writes:
In article <2k************ @uni-berlin.de>,
Oliver Fromme <ol**@haluter.f romme.com> wrote:

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.


Well, different. I can't stand lynx.

Cheers,
mwh

--
If you don't use emacs, you're a pathetic, mewling, masochistic
weakling and I can't be bothered to convert you. -- Ron Echeverri
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
21393
by: Rajesh Garg | last post by:
Can we have private constructors and destructors? IF yes what is the use of such constructors or destructors.....in the sense where can these be implemented in a system................. I have an idea that we can have private constructors and destructors but am not able to find a situation where they can be used... Regards RVG rajeshgarg@opussoft.com
3
2717
by: Nuno Barros | last post by:
Cn someone tell me if when i call the destructor of a derivated class, the destructor of the base class is called implicitly? Or shall i call the destructor by myself? Thanks in advance Nuno Barros
12
1817
by: Ross Boylan | last post by:
I am trying to understand under what circumstances destructors get called with std::vector. I have an application in which I will put real objects, not just pointers, in the vector. 1. The standard says that empty() has constant complexity. If it actually called the destructor for each object, it seems to me it would have linear complexity. Does empty() call the destructor for each object in the container? If yes, why is it described...
8
1430
by: johny smith | last post by:
If I have a simple class with say a couple of integers only is there any need for me to provide a destructor? thanks!
26
2725
by: Michi Henning | last post by:
I've been having problem with destructors in the context of having ported C# code developed under .NET to Mono. What happens is that, on a dual-CPU machine, various parts of the code crash randomly (and rarely). This always happens during process shutdown, after some thread has called System.Environment.Exit(). Clearly, some sort of race condition. Note that what follows only applies to destructors that are called when the process shuts...
8
1807
by: Edward Diener | last post by:
I have a __value class which uses some legacy C++ code. So I wrapped the legacy C++ code in another __nogc class and have a pointer to that class as a member of my __value class. When the __value class is created, I dynamically allocate an object of the class with the legacy C++ code. However because the __value class has no destructor, I can never release that allocated memory. Why does a __value class allow no destructor ? Without it I...
3
1895
by: alex.gman | last post by:
If I have code like this int f() { // ... stuff ... g(); if(x > 0) return (x+4); // ... more stuff ... always_call(z); return y; }
6
7531
by: mlw | last post by:
Could someone explain why there is no destructor in Java classes? There are many times you need to be called WHEN an object goes out of scope and not when it will eventally be freed.
6
5166
by: Jeff Newman | last post by:
Hello, Could anyone explain to me why the following class's destructor shows up as having multiple branches? (At least as judged by gcov 4.1.2 when compiled with gcc 4.1.2 ): struct blah { blah(); virtual ~blah();
0
9632
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9471
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10136
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.