Raymond Hettinger
@raymondh
Followers
75K
Following
4K
Media
77
Statuses
6K
Chief trainer for Mutable Minds. Certified Public Accountant, Retired Python guru. Alloy & TLA⁺ enthusiast. Aspiring pianist. Former pilot. Born at 320 ppm CO₂.
Austin, TX
Joined March 2008
QOTD: "There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies." -- C.A.R. Hoare
2
6
47
#Python notes: imap_unordered() has less overhead than imap() and map(). Calls to imap and map do not yield results immediately. Instead, they buffer results in memory until the ordering and completion requirements are met. This eats memory and impairs responsiveness.
1
2
35
Often it is the most basic questions that are the hardest to answer. * What is a number? * What is a straight-line? * What do you mean by "continuous"? * What is "red"? * What is "attention"? * When is something "conscious"? * What is "casual"?
7
2
44
#Python recipe of the day: relu = functools.partial(max, 0.0) Presto, you have rectified linear unit for a neural net. https://t.co/lDEk3zgVDy
geeksforgeeks.org
Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling,...
2
7
52
In your experience, are LLMs as vulnerable as humans to be thrown-off by incorrect code comments?
6
2
17
#Python notes: The Counter in the collections module supports two kinds of arithmetic. The update() and subtract() methods implement normal arithmetic with possible negative numbers in the results. The "+" and "-" implement saturating arithmetic giving non-negative results.
1
1
28
#Python teaching tool: To demonstrate testing and debugging, I often use this function: def square(n: int) -> int: return sum(n - 2 for i in range(n + 2)) + 4 Tests pass for n=100, n=7, n=1, n=0, n=-1, and n=-2. But fail for n=-5. Tests can't prove the absence of errors.
1
6
43
#Python teaching tip: If someone says, "I didn't get topic X, can you go over it again" that means that your approach wasn't successful. Don't say the same words over again. Instead, approach the topic from a completely different angle. Home in on what works.
3
9
87
With the itertool module: • next(compress(iterable, repeat(False)), None) • next(dropwhile(id, iterable), None) • next(islice(iterable, sys.maxsize, None), None) • iterator = groupby(iterable, key=lambda x: None) next(iterator, None) next(iterator, None) (that's all)
1
0
11
With builtins: • set(map(type, zip(iterable))) • min(map(bool, zip(iterable))) With the collections module: • deque(iterable, maxlen=0) (more)
1
0
10
For me, the Desmos Graphing Calculator sparks joy. Its API designers are true craftsmen (and women). The tool is approachable for kids, powerful enough for real world use, and completely devoid of cruft/nonsense. It takes discipline to make something this good.
0
2
32
Overall, AI Is Making Humans More Stupid AI makes 1% of us smarter and the remaining 99% stupider. The 1% are using AI to learn and do things, and know how to use it effectively. The remaining 99% blindly use AI to copy homework, write emails they don't read, try vibe coding,
84
35
312
asyncio is still really wild in 2025. I haven't actively written asyncio code in a while but now that I have done it for a week agian, I noticed that most problems from when I used it last are still unresolved. Problem 1: asyncio.create_task is a massive footgun because it can
30
67
716