Implicit initialization is EVIL!
steve+comp.lang.python at pearwood.info
Wed Jul 6 18:11:28 CEST 2011
>> In the Mac OS GUI, an application can have a menubar and no windows.
>> Windows come and go as needed, but the menubar stays until the users
>> quits the application.
> That's just window visibility (whether by hiding or destroying) under
> the veil of a detached UI window manager bar and has nothing to do
> with window hierarchy.
If all the windows are destroyed, and the application still is running and
active, where is your window hierarchy?
The Dead Window Sketch
(with apologies to Monty Python)
Customer enters a pet shop.
Customer: 'Ello, I wish to register a complaint.
Owner: We're closin' for lunch.
Customer: Never mind that, my lad. I wish to complain about this GUI
window what I purchased not half an hour ago from this very
Owner: Oh yes, the Norwegian Blue. What's wrong with it?
Customer: I'll tell you what's wrong with it, my lad. It's deleted,
that's what's wrong with it!
Owner: No, no, it's resting!
Customer: Look, matey, I know a deleted window when I see one, and I'm
looking at one right now.
Owner: No no it's not deleted, it's restin'! Remarkable window, the
Norwegian Blue. Beautiful widgets!
Customer: The widgets don't enter into it. It's completely destroyed.
Owner: Nononono, no, no! It's resting!
Customer: All right then, if it's restin', I'll wake it up!
(shouting at the screen) 'Ello, Mister Wally Window! I've got
a lovely fresh icon for you if you show...
(owner hits the screen)
Owner: There, it refreshed!
Customer: No, it didn't, that was you hitting the screen!
Owner: I never!!
Customer: Yes, you did!
Owner: I never, never did anything...
Customer: (yelling and hitting the screen repeatedly) 'ELLO WINDOW!!!
WAKEY WAKEY! This is your notification signal!!!
(takes the window out of the screen and thumps its title bar
on the counter. Throws it up in the air and watches it plummet
to the floor.)
Customer: Now that's what I call a dead window.
Owner: No, no... No, it's stunned!
Owner: Yeah! You stunned it, just as it was maximising! Norwegian
Blues stun easily.
Customer: Now look, mate, I've definitely 'ad enough of this! That
window is definitely deleted, and when I purchased it not
'alf an hour ago, you assured me that its lack of an entry
in the task bar was due to it bein' tired and shagged out
following a long refresh!
Owner: Well, it's... probably pining for the fjords.
Customer: PININ' for the FJORDS?!?!?!? What kind of talk is that? Look,
why did it fall flat on its back the moment I got it home?
Owner: The Norwegian Blue prefers being minimised on its back!
Remarkable bird, i'nit, squire? Lovely scroll bars!
Customer: Look, I took the liberty of examining that window when I
got it home, and I discovered the only reason that the
window was still visible in the first place was that it
had been NAILED there.
Owner: Well, o'course it was nailed there! If I hadn't nailed that
window down, it would have nuzzled up to those pixels, bent
'em apart with its cursor, and VOOM! Feeweeweewee!
Customer: "VOOM"?!? Mate, this window wouldn't "voom" if you put four
million volts through it! Its bleedin' memory is reclaimed!
Owner: No no! It's pining!
Customer: It's not pinin'! It's purged! This window is no more! It's
pointer has ceased to be! It's expired and gone to meet the
memory manager! Bereft of bytes, it rests in peace! If you
hadn't nailed it to the screen it'd be a Flash animation in
a browser by now! It's callbacks are now 'istory! Its ref
count is zero! It's called the garbage collector, its blocks
have been cleared, shuffled off this mortal coil, run down
the curtain and joined the bleedin' choir invisibile!! THIS
IS AN EX-WINDOW!!
Owner: Well, I'd better replace it, then.
(he takes a quick peek behind the counter)
Owner: Sorry squire, I've had a look 'round the back of the shop, and
uh, we're right out of windows.
Customer: I see. I see, I get the picture.
Owner: I got a DOS batch file.
Customer: (sweet as sugar) Pray, does it talk?
Customer: Right, I'll have that one then.
More information about the Python-list