[Python-3000] iostack and Oh Oh

Jim Jewett jimjjewett at gmail.com
Mon Dec 4 02:12:19 CET 2006


On 12/3/06, Bill Janssen <janssen at parc.com> wrote:
> Phillip Eby writes:
> > what you want a "mapping" to do may not be the same as what
> > somebody else wants a "mapping" to do

> That's when they'd use two different interfaces, of course.

I think Phillip's point is that most people wouldn't, really.  You're
lucky if someone documents "mapping" rather than "dict".  They are
almost never more specific.

After interfaces, some people probably still won't be more specfic.
They might say "MinimalMapping" if it is in the standard library, but
they won't (and probably *shouldn't*, as a matter of space) document
each particular method.

Someone else will come along, peek at the code, and say "They want a
mapping, but don't use method X, so I can cheat."  And they will, but
they'll still *claim* to implement mapping, because that is what the
library asks for.

The end result is just as much incompatibility as today, but now the
library writer can get all huffy about how it was documented, careful
writers will be more likely to fill out junk methods, and there will
be more boilerplate.

I'm not sure these problems can't be worked around, but ... I'm not
sure how, particularly without supplying default implementations right
on the interface.

Simply allowing people to declare an interface probably isn't enough
to gain the full benefits, though it might be enough to incur the
costs.

> What I'd like to see as documentation is more along the lines of

>   foo (types.Mapping m, (types.SeekableStream, types.BinaryOutputStream) f) => types.Integer

That starts to get long enough that people skip it as boilerplate.

> and *no* human-readable text giving an inaccurate and incomplete
> description of the parameters.

But will they really use the minimally correct interface, or will they round up?

-jJ


More information about the Python-3000 mailing list