Evaluate once or every time
2QdxY4RzWzUUiLuE at potatochowder.com
2QdxY4RzWzUUiLuE at potatochowder.com
Fri Feb 24 19:00:17 EST 2023
On 2023-02-24 at 18:42:39 -0500,
Thomas Passin <list1 at tompassin.net> wrote:
> VOWELS = 'aeiouAEIOU'
> is_vowel = 'y' in VOWELS
>
> If I really needed them to be in a list, I'd probably do a list
> comprehension:
>
> VOWEL_LIST = [ch for ch in VOWELS]
Why use a comprehension when a simple loop will do? ;-)
No. Wait. That's not what I meant.
Why use a comprehension when the constructor will do?
VOWEL_LIST = list(VOWELS)
More information about the Python-list
mailing list