[Zope3-dev] Re: proposal: replace zope.schema.Sequence with
zope.schema.Collection
Fred Drake
fred at zope.com
Wed Apr 28 16:16:16 EDT 2004
On Wednesday 28 April 2004 03:28 pm, Gary Poster wrote:
> In zope/schema/_field.py, Stephan implements Sequence, then subclasses
> Sequence for Tuple, List, and Set. This is ok, since its
> implementation, but ISet also subclasses ISequence, which is wrong
> (since a set is not a sequence: it is not ordered).
Definately!
> IMO, Stephan has identified a clear place in which our model could be
> improved. Rather than merely making ISet not subclass ISequence (and
> make it just subclass IField, I suppose), I propose that
>
> * "Sequence" be renamed to "Collection" (and "ISequence" to
> "ICollection");
> * "Collection" include an "ordered=True" keyword argument;
> * "List" and "Tuple" subclass "Collection" (and same for interfaces)
> and disallow setting of "ordered" (it must always be True);
> * "Set" subclass "Collection" (and same for interfaces) and disallow
> setting of "ordered" (it must always be False); and
> * (less importantly) "Set" default to creating a Sets.set.
I just spoke with Gary, and am proposing a slight modification of this change:
- Collection is added as a base for Sequence (and ICollection for ISequence)
- Sequence will set ordered=True and disallow changing it
- List and Tuple subclass Sequence
> I'll give this a whirl unless someone stops me. Thoughts?
Some days, yes.
-Fred
--
Fred L. Drake, Jr. <fred at zope.com>
PythonLabs at Zope Corporation
More information about the Zope3-dev
mailing list