[Python-3000] Thoughts on dictionary views
Nick Coghlan
ncoghlan at gmail.com
Wed Feb 21 13:41:15 CET 2007
Guido van Rossum wrote:
> On 2/20/07, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> My apologies for rambling a bit - I can't currently give a succinct
>> explanation for why the current direction feels wrong, but I felt it was
>> worth supporting Raymond on this point.
>
> Apologies accepted -- but yes, you did ramble a bit, and I still wish
> you'd collected your thoughts a bit more. if there are simple clear
> arguments it's easier for me to accept or reject them than with a
> bunch of ramblings. Sorry to be grumpy, but given the implementation
> stage this is in and how long the PEP has been sitting unchanged I'm a
> bit annoyed that the criticism, valid or not, comes so late.
Views that don't allow you to modify the contents of the original
mapping make me *much* happier - I hadn't realised you'd left that
aspect out of the implementation.
Simply having different views of the underlying object is something with
a strong precedent in normal iterators (and, in fact, it would be
perfectly possible to *teach* keys(), values() and items() that way,
leaving the introduction of their other features until later in the
learning process).
Using multiple access points to edit the same data set, while a powerful
idea, can be pretty difficult to keep straight while writing code - and
I think having such a feature in the basic dict API is what was really
bothering me. (It bothers me significantly less in more advanced API's,
like NumPy, or the attrview wrapper class recipe)
As penance for my doubts, I've committed fixes for various dict-related
test failures in the py3k branch :)
Cheers,
Nick.
P.S. I don't have bsddb in my devel tree, so I couldn't fix that, and
there are a couple of other failures that require further investigation
to figure out what is going on. I updated the BROKEN file to reflect the
current status (that seems like a good way to avoid cluttering the SF
tracker until we get the tree into a state where we want to start
running buildbots on it)
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list