[Zope3-dev] proposal: replace zope.schema.Sequence with zope.schema.Collection

Martijn Faassen faassen at infrae.com
Thu Apr 29 08:08:45 EDT 2004


Stephan Richter wrote:
> I would prefer 
> 
> numbers = Collection(
>     title=u"Numbers",
>     unique=True,
>     ordered=True)
> 
> be much nicer than
> 
> numbers = List(
>     title=u"Numbers",
>     unique=True)
> 
> since it is much more explicit and I do not have to remember the rules for 
> what a set or a list is.

It's not more explicit, because a Python programmer should understand 
that lists are unordered and that sets are unordered if they're using 
them at all.

The first is more verbose and you have to look harder to figure out an 
important property.

> Also, notice that at least 70% of the time where we 
> use a List/Sequence now, it could be also a set. Usually we do not care about 
> order.

If you really don't care about order (UI people do care very strongly 
about ordering in the UI though, but I guess that can be handld at the 
widget level?), then you can indeed safely use Set.

Regards,

Martijn



More information about the Zope3-dev mailing list