Re:Python: Uncovering the Overlooked Core Functionalities
by Jtsummers on Monday July 24, 2023 @11:05PM
(#36857350)
Map and filter don't actually consume anything until they're used later, they produce iterables. So if you pulled them into their own lines they wouldn't consume (much) extra memory. Taking the original:
An alternative is also to use a generator comprehension that's identical to the inner part (in effect):
Which could still be pulled out to a pair of lines for clarity:
[ Parent
| on HN ]
There are no comments on this comment yet.