[Python-Dev] Add a "transformdict" to collections
Antoine Pitrou
solipsis at pitrou.net
Tue Sep 10 20:31:40 CEST 2013
On Tue, 10 Sep 2013 14:44:01 +0200
"Martin v. Löwis" <martin at v.loewis.de> wrote:
> Am 10.09.13 14:35, schrieb Antoine Pitrou:
> >> ['FOO'] or ['foo']? Both answers are justifiable. Both are possibly
> >> even useful depending on context...
> >
> > I think it would be best to leave it as an implementation detail,
> > because whichever is easiest to implement depends on the exact
> > implementation choices (e.g. C vs. Python).
>
> I think this is the point where the datatype is *not* clearly
> straight-forward, and thus deserves a PEP.
Not saying you're necessary wrong, but a few data points:
- defaultdict was added without a PEP:
http://bugs.python.org/issue1433928
- Counter was added without a PEP:
http://bugs.python.org/issue1696199
- ChainMap was added without a PEP:
http://bugs.python.org/issue11089
http://bugs.python.org/issue11297
- namedtuple was added without a PEP:
https://mail.python.org/pipermail/python-dev/2007-February/071196.html
(no tracker reference for its addition)
OrderedDict, however, came with a PEP:
http://www.python.org/dev/peps/pep-0372/
> I think it would be a flaw to have this detail implementation-defined.
> This would be like saying that it is implementation-defined which
> of A,B,C is returned from "A and B and C" if all are true.
Ok, it seems everyone (except me :-)) agrees that it should return the
first key value, so that's how it will be.
Regards
Antoine.
More information about the Python-Dev
mailing list