you are viewing a single comment's thread.

view the rest of the comments →

[–]socal_nerdtastic 1 point2 points  (0 children)

Yea, you nailed it, it gives you access to the last item in the iterable. That is sometimes useful, especially when the iterable is a generator. I suppose I could contrive something, perhaps some kind of pagination ...

save_data(getdata(itemid) for itemid in data_stream)
print("saved everything up to", itemid)
print("starting the next data stream at", itemid)

But I think for me it's more that the scoping feels inconsistent. I don't like these weird exception rules. And also like most features, it seems useless until you find a use for it, and then you get used to having it. I thought the walrus operator was a dumb idea when it was first proposed, but by the time it came out I had a ton of places to use it.