1. X
  2. Raymond Hettinger
Log inSign up
Raymond Hettinger
6,235 posts
user avatar

Raymond Hettinger

@raymondh
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
rhettinger.wordpress.com
Joined March 2008
543
Following
74.6K
Followers
RepliesRepliesMediaMedia
  • Pinned
    user avatar
    Raymond Hettinger
    @raymondh
    Aug 7, 2024
    #Python tip: If you were to devote a little effort into mastering just one itertool, it should be islice(). Its motivation was to be an analogue of sequence slicing but with next-in-a-loop as the foundation rather than __getitem__() and __len__().
  • user avatar
    Raymond Hettinger
    @raymondh
    Feb 27
    #Python design tip: Only use @property for O(1) operations. People rightly expect that anything that looks like attribute access is fast. Don't want to Cntl-C out of an attribute lookup that Deep Thought takes 7.5 million years to compute: >>> life.meaning 42
  • user avatar
    Raymond Hettinger
    @raymondh
    Feb 4
    Added a new #python itertools recipe today: def running_mean(iterable): "Yield the average of all values seen so far." # running_mean([8.5, 9.5, 7.5, 6.5]) -> 8.5 9.0 8.5 8.0 return map(truediv, accumulate(iterable), count(1))
  • user avatar
    Raymond Hettinger
    @raymondh
    Jan 22
    Observation from Matthew: sin(15°) ≠ sin(15⁰) The sine of 15 degrees is not the equal to the sine of 15 to the zeroth power.
  • user avatar
    Raymond Hettinger
    @raymondh
    Aug 26, 2025
    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

Log in or sign up for X

See what’s happening and join the conversation

Continue with phone
or
Log in with username or email
Terms·Privacy·Cookies·Accessibility·Ads Info·© 2026 X Corp.
Advertisement
Advertisement