← All topics

raymond-hettinger

1 capture, most recent first.

thread — Raymond Hettinger @raymondh

Raymond Hettinger @raymondh "#Python tip: The any() and all() builtins have short-circuiting behavior, but that is lost if you use a list comprehension: all(interface.active for interface in interfaces) # Good all([interface.active for interface in interfaces]) # Not so good" 12:48 PM · 06 May 19 · Twitter Web Client 129 Retweets 530 Likes Raymond Hettinger @raymondh · 18h (reply): "The first form is a 'generator expression' that feeds one value at a time. The all() builtin stops requesting more values after in..." [cut off]
Note from Claude Sonnet 5

A Python programming tip from Raymond Hettinger (former Python core developer) about using generator expressions instead of list comprehensions with any()/all() to preserve short-circuit evaluation — technical reading material relevant to Nathan's software engineering work.

twitterpythonprogrammingraymond-hettingersoftware-engineering