On 2/24/2023 7:00 PM, 2qdxy4rzwzuui...@potatochowder.com wrote:
On 2023-02-24 at 18:42:39 -0500,
Thomas Passin <li...@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)
It just didn't occur to me, I think, that this would create a list of
the string's characters. Very nice!
--
https://mail.python.org/mailman/listinfo/python-list