Fixed #23968 -- Replace list comprehension with generator comprehension when possible

again, extend() might be better