3 ms·
Right. I think it works better in Python — although I'm partial towards `[family] = socket.peeraddr` or adding parens as the comma is a bit hard to see — becaus
by masklinn 13y ago
Right. I think it works better in Python — although I'm partial towards `[family] = socket.peeraddr` or adding parens as the comma is a bit hard to see — because it also asserts that the RHS is a single-item iterable (or however many items you have on the left-hand side:
>>> [a] = range(1)
>>> [a] = range(2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: too many values to unpack
and it works on any iterable (any object with #to_a in ruby).