"Deborah Swanson" <pyt...@deborahswanson.net> writes: > Peter Otten wrote, on January 08, 2017 3:01 AM >> >> columnA = [record.A for record in records] > > This is very neat. Something like a list comprehension for named tuples?
Not something like - this *is* a list comprehension - it creates a list of named tuples. The thing you iterate over within the comprehension can be any iterator. (Of course you're going to run into problems if you try to construct a list from an infinite iterator.) -- https://mail.python.org/mailman/listinfo/python-list