4 ms·
exhaust((file.close() for file in files)) works.
by xrisk 5y ago
exhaust((file.close() for file in files)) works.
- klyrs 5y agoLike I said, contrived example. Though, it's a specific example of a more general pattern where you have a bunch of objects that you need to send a message to. You might use this for event handling in the guts of a game engine.
- elteto 5y agoI believe exhaust(file.close() for file in files) should work as well, no need for the extra parens.