annotate Tools/scripts/dutree.doc @ 87690:66c1c9f32567 default tip

Add use_weakref option to functools.lru_cache The use_weakref option makes lru_cache create weak references to the function arguments when creating the cache key, which prevents them from staying in the memory forever even after all other references to them are gone. This is a proof of concept for http://bugs.python.org/issue19859
author Radomir Dopieralski <devel@sheep.art.pl>
date Tue, 03 Dec 2013 16:02:48 +0100
parents e15bea971a5b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
687
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 Path: cwi.nl!sun4nl!mcsun!uunet!cs.utexas.edu!convex!usenet
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 From: tchrist@convex.COM (Tom Christiansen)
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 Newsgroups: comp.lang.perl
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 Subject: Re: The problems of Perl (Re: Question (silly?))
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 Message-ID: <1992Jan17.053115.4220@convex.com>
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 Date: 17 Jan 92 05:31:15 GMT
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 References: <17458@ector.cs.purdue.edu> <1992Jan16.165347.25583@cherokee.uswest.com> <=#Hues+4@cs.psu.edu>
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 Sender: usenet@convex.com (news access account)
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 Reply-To: tchrist@convex.COM (Tom Christiansen)
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 Organization: CONVEX Realtime Development, Colorado Springs, CO
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 Lines: 83
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 Nntp-Posting-Host: pixel.convex.com
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
13
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 From the keyboard of flee@cs.psu.edu (Felix Lee):
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 :And Perl is definitely awkward with data types. I haven't yet found a
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 :pleasant way of shoving non-trivial data types into Perl's grammar.
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
17
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 Yes, it's pretty aweful at that, alright. Sometimes I write perl programs
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 that need them, and sometimes it just takes a little creativity. But
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 sometimes it's not worth it. I actually wrote a C program the other day
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
21 (gasp) because I didn't want to deal with a game matrix with six links per node.
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
22
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 :Here's a very simple problem that's tricky to express in Perl: process
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
24 :the output of "du" to produce output that's indented to reflect the
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
25 :tree structure, and with each subtree sorted by size. Something like:
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 : 434 /etc
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
27 : | 344 .
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
28 : | 50 install
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
29 : | 35 uucp
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
30 : | 3 nserve
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
31 : | | 2 .
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
32 : | | 1 auth.info
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
33 : | 1 sm
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
34 : | 1 sm.bak
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
35
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
36 At first I thought I could just keep one local list around
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
37 at once, but this seems inherently recursive. Which means
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 I need an real recursive data structure. Maybe you could
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
39 do it with one of the %assoc arrays Larry uses in the begat
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
40 programs, but I broke down and got dirty. I think the hardest
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 part was matching Felix's desired output exactly. It's not
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
42 blazingly fast: I should probably inline the &childof routine,
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
43 but it *was* faster to write than I could have written the
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
44 equivalent C program.
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
45
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
46
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 --tom
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
48
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
49 --
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 "GUIs normally make it simple to accomplish simple actions and impossible
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
51 to accomplish complex actions." --Doug Gwyn (22/Jun/91 in comp.unix.wizards)
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
52
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
53 Tom Christiansen tchrist@convex.com convex!tchrist
e15bea971a5b Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
54