On Tue, Dec 15, 2015 at 8:08 AM, Jelte Fennema <me@jeltef.nl> wrote:
Secondly, I think your idea for namedtuple literals is great. This would be really useful in the namedtuple use case where you want to return multiple values from a function, but you want to be clear in what these values actually are. I think this would need to generate some kind of anonymous named tuple class though, since it would make no sense to have to create a new class when using a literal like this.
Whoa whoa whoa. I wasn't suggesting a namedtuple literal. Let's not bring down the wrath of the gods. (Also, it's come up before (https://mail.python.org/pipermail/python-ideas/2014-April/027434.html) and I was part of the discussion (https://mail.python.org/pipermail/python-ideas/2014-April/027602.html). So it's not my idea.) (And it shouldn't be namedtuple, exactly, since namedtuple is a metaclass which generates classes with names. Attrtuple? For performance, it would map [keylist] => attrtuple[keylist]. Earlier discussion here: https://mail.python.org/pipermail/python-ideas/2013-June/021277.html)