3 ms·
That's not the point, destructuring works fine on classes implementing `__iter__`: class A: def __iter__(self): return iter(range(3))
by filmor 9y ago
That's not the point, destructuring works fine on classes implementing `__iter__`:
class A:
def __iter__(self):
return iter(range(3))
for x, y, z in [A(), A(), A()]:
print(x, y, z)
Prints
0 1 2
0 1 2
0 1 2
- carapace 9y agoTIL, cheers!