On 7/26/17, Steven D'Aprano <[email protected]> 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)
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/