[Zope-dev] An idea for UniqueValuesFor

Chris Withers chrisw@nipltd.com
Mon, 23 Jul 2001 09:40:52 +0100


I quite often need to do something like:

results =
MyCatalog(meta_type='Person',continent='Africa').uniqueValuesFor('FirstName')

...which would give you the minimal list of firstnames of people who live in
Africa. A bit contrived but I seem to bump into lots of real world cases where I
need to do similar.

What I currently have to do is the brutal and slow approach of "walk through the
results" :-S

But Anthony came up with a great suggestion:

> What would make more sense (maybe?) is
> results =
> MyCatalog(meta_type='Person',continent='Africa',uniqueValuesFor='FirstName')

What do other people think? Is there a nice fast way of implementing this?

cheers,

Chris