[Python-3000] Iterators for dict keys, values, and items == annoying :)

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 1 02:39:16 CEST 2006


Paul Moore wrote:

> The "traditional" solution, __index__, requires co-operation
> from all classes that want to support the new protocol. Adaptation
> doesn't - it can be added externally.

I don't follow that. Adaptation only works if the
framework author has thought to make an adaptation
call at the point where it's needed.

If I, as the framework author, were the one that
benefited from making adaptation calls, then I
could leave them until I needed them. But that's
not how it works -- it's *users* of my framework
that benefit, and they're not in a position to
add them to my framework. So I have to think
ahead and try to anticipate what adaptations
other people might want my code to make.

> Rather than being a solution looking for a problem, I suspect it's
> more of a chicken and egg issue.

It's more than that, I think -- it's that making
effective use of it requires predicting the
future. Until time machines become a commodity
item, that isn't going to make adoption easy.

--
Greg


More information about the Python-3000 mailing list