[Python-ideas] Dict literal use for custom dict classes

Franklin? Lee leewangzhong+python at gmail.com
Tue Dec 15 09:41:17 EST 2015


On Tue, Dec 15, 2015 at 8:08 AM, Jelte Fennema <me at 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)


More information about the Python-ideas mailing list