On Lists and Iterables
Xen
list at xenhideout.nl
Fri Dec 15 10:40:14 UTC 2017
I am just posting this so I don't have to save the text.
2.7: type(zip(["a","b"], ["c","d"]))
<type 'list'>
3 : type(zip(["a","b"], ["c","d"]))
<class 'zip'>
3 : zip(["a","b"], ["c","d"])
<zip object at 0x7f684fd71708>
2.7: zip(["a","b"], ["c","d"])
[('a', 'c'), ('b', 'd')]
3 : list(zip(["a","b"], ["c","d"]))
[('a', 'c'), ('b', 'd')]
I don't even know what Iterables are.
I just know that I can't print them directly.
Python is supposed to be a beginner-friendly language.
But this is incomprehensible.
Zipping by definition produces a list of tuples, I mean zipping a list
by definition creates a list of tuples, not a "zip" object.
The whole semantic definition of "zip" is to take 2 (or more) lists,
then create tuples out of every matched list element, and return those
as a new list.
Not to be left in some intermediate stage which is somehow more
efficient to the interpreter or something.
That would be like calling Set.difference and then getting a Difference
object instead of a Set.
Just an example of a user-unfriendly change.
I already know someone is going to say "No it's not." and then leave it
at that.
About the above.
Regards.
More information about the Ubuntu-devel-discuss
mailing list