[Python-3000] Need help completing ABC pep
janssen at parc.com
Fri Apr 20 21:07:04 CEST 2007
A good start. A few comments:
Where do strings and bytes fit in? They seem to be sequences. Are
they sub-typable? If so, shouldn't their base interface be defined?
I'd either add numeric types to this, or split it in two pieces: one
about ABCs in general (perhaps defining Comparable and Object), and
another for collection types. Then a third for numeric types.
I don't like the name of the "pop()" method on Sets. It's too much
associated with stacks. People reading code that uses "pop" on a value
will naturally assume that the value is a stack. I'd prefer
> Python will not require that a class derives from BasicMapping or
> Sequence when it defines a __getitem__ method,
> nor will the x[y] syntax require that x is an instance of either ABC.
> You will still be able to assign any "file-like" object to
> sys.stdout, as long as it has a write method.
Well, yes, but... I think there should be an ABC for "file-like",
which the standard "file" and "StringIO" implementations inherit from.
This could even be a fourth PEP.
More information about the Python-3000