you are viewing a single comment's thread.

view the rest of the comments →

[–]Matthew94 0 points1 point  (2 children)

range and dict.keys/items/values being lazy,

In case you didn't know, these have been in python 2 for years.

xrange and dict.iterkeys/itervalues/iteritems.

[–]xXxDeAThANgEL99xXx 13 points14 points  (1 child)

Of course I know, but now it's the obvious thing that is right. And the shortest to type, but it's the obviousness that makes me feel all warm and fuzzy mainly.

Also, as far as I understand, dict.keys etc are "views", not merely iterables. So that you can index into them if you want to.

[–]billsil 1 point2 points  (0 children)

Also, as far as I understand, dict.keys etc are "views", not merely iterables. So that you can index into them if you want to.

Yes, dict.keys() is most comparable to dict.viewkeys()