Implicit initialization is EVIL!

Chris Angelico rosuav at
Tue Jul 5 19:20:53 EDT 2011

On Wed, Jul 6, 2011 at 8:42 AM, rantingrick <rantingrick at> wrote:
> Chris are you playing devils advocate (for my team). I am confused? :-)

I say whatever I choose to say. Don't pigeon-hole me into "on your
team" or "not on your team" or "devil's advocate" or whatever. And at
two in the morning, "whatever I choose to say" can be quite random. :)

> On Jul 5, 11:00 am, Web Dreamer <webdrea... at> wrote:
>> What he means is that On Mac, if you close "all" windows, the application is
>> still running.
> Then that is NOT closing windows that is only ICONIFIYING/HIDING them.
> Let's use the correct lingo people!

Actually, it IS closing those windows. Why wouldn't it be?

1) User presses Alt-F4, or clicks the X, or opens the system menu and
chooses 'Close Window'.
2) Windowing manager sends a message to the appropriate thread's queue
(on MS Windows, that's WM_CLOSE; not sure how on Linux as I haven't
bothered to dig that deep - interface layers like Tkinter and GTK
don't count).
2a) Toolkit passes message to application code, if applicable.
3) Application destroys this window, leaving the other windows alive.

The memory used by that window can be reclaimed. Handles to its
objects are no longer valid. The window really is closed. The
application might not have terminated, but that window has not been
minimized - the *window* is closed.

> And how do you EXPLICITY quit the application? Because the interface
> for window management(on windows box) is three buttons "minimize",
> "maximize", and "destroy". If closing the window only "hides" the
> window then you are just "managing" a window's "visibility". We are
> talking about destroying GUI processes here.

Presumably you would right-click it and choose "Exit" or something. Up
to the application. If all else fails, kill -9 it.

The interface for window management does not actually have "destroy",
it has "close". The normal handling of a close message is to destroy
the window; and in many applications, once all windows have been
destroyed, the process terminates. These are three quite separate
concepts. The separation of "close" and "destroy" is most easily seen
in "Are you sure" prompts - you send a Close signal to the window, but
the application queries you before going through with the destruction.
And even once the last window has been destroyed, that has nothing to
do with process termination.

I could conceivably write a program that sits invisibly in the
background until a network message arrives. Upon receipt of such a
message, the program initializes the GUI subsystem and opens a window.
When the user closes the window, the program flushes all GUI code out
of memory and waits for the next message. While it's waiting, is there
any "main window" that exists but has just been hidden? No. But is the
application still running? Of course! Completely separate.


More information about the Python-list mailing list