The specific answer: https://stackoverflow.com/posts/209854/revisions, which is the top answer on a very popular question, How can I make a dictionary from separate lists of keys and values?.
The changelog shows repeated attempts over the past three years to remove noise and clarify how the answer works to solve the problem. I was just about to make a change manually that would have amounted, essentially, to "rollback to revision 9", when I randomly decided to look in to the edit history (it seemed strange that there was a recent edit on an ancient answer that left noise behind).
How should I handle this sort of situation? Is it appropriate to ask the author in the comments for a reason to resist these changes? I'm not sure I'd accept one anyway. I have read What to do when a high-rep user is willfully breaking site rules/meta consensus? but I didn't manage to extract useful guidance from it.
dict
andzip
work together to make the solution work.Voila :)
… is that so? 🤨zip
certainly does not create a list of(key, value)
tuples.zip(keys, values)
does create an iterator of(key, value)
tuples. (Not list, admittedly.) I think it's much more helpful to beginners rather than "...zip function are awesomely useful". But I might be a bit biased since that edit was mine. :-)zip
isn't a function in 3.x; it's a class. The returned value isn't a generator object, but an actual instance of that class.