I feel I should probably prepend this with a note that some people really don’t like the unpacking operator and especially combining it with
zip (think readability and long term maintenance). Therefore you should think twice about writing code this way. Can it be understood? Can it be changed easily?
Writing single use code is very different to code that others have to read and work with. One liners in general might save you several seconds typing but they also risk slowing down long term development. So just consider carefully whether or not shorter code is better code here (and in general). Wiser heads than mine would urge you to consider long term maintenance above all else, certainly more so than saving yourself a few seconds now.
Python has an unpacking operator
* which may be close to what you want-
One minor issue is that your original data is packed the wrong way for this, but there’s a near trick to combine both
zip and the unpacking operator effectively transposing your data. Compare the two-
If you can’t read that easily then try the following (more for debugging than actual useful code)-
print(*highlighted_poems_details, sep="\n", end="\n\n")
The important bit there is the
titles, poets, dates = zip(*highlighted_poems_details)
If this was combined with a list comprehension or mapping you could get lists from iterating through the zip instead of tuples. Once again though, readability and especially long term maintenance should always be considered (a for loop is easy to change bit by bit, a comprehension is not).