
July 27, 2017
9:22 p.m.
On 7/26/17, Steven D'Aprano <steve@pearwood.info> wrote: [...]
But this has a hidden landmine. If *any* module happens to use ntuple with the same field names as you, but in a different order, you will have mysterious bugs:
x, y, z = spam
You expect x=2, y=1, z=0 because that's the way you defined the field order, but unknown to you some other module got in first and defined it as [z, y, x] and so your code will silently do the wrong thing.
We have: from module import x, y, z # where order is not important Could we have something similar with ntuple (SimpleNamespace, ...)? maybe: for x, y, z from spam: print(x, y, z)