Comment on Retiring a Great Interview ProblemparentComments−sur15yHe is using parentheses instead of square brackets, so the code is actually using a generator expression which will produce each value lazily.−eru15yIs mydict.items() also lazy?−kragen15yIn Python 3 yes, in Python 2 no. In Python 2 you'd say mydict.iteritems() if you were concerned about it.
Comments
He is using parentheses instead of square brackets, so the code is actually using a generator expression which will produce each value lazily.
Is mydict.items() also lazy?
In Python 3 yes, in Python 2 no. In Python 2 you'd say mydict.iteritems() if you were concerned about it.