matching objects by a tuple field criterion

John Machin sjmachin at lexicon.net
Sun Jun 10 08:45:47 EDT 2007


On Jun 10, 10:32 pm, bullockbefriending bard <kinch1... at gmail.com>
wrote:
> quite so, i rephrased docstring to be:
>
> """criteria is an iterable containing either '*' instances or  strings
> of comma-separated integers. e.g.  ['*','1,2,3', '11,12']"""
>
> thanks very much for the idea! upon further reflection, this seems to
> be a more elegant solution for my case than the ad-hoc generator or
> list comprehension approach. this is because i *do* have to filter
> data based on multiple single field criteria and i know all of these
> criteria at the same time - so it makes a lot of sense to do as you
> have done and then only do one filter operation to pull out all the
> objects i am interested in.

"""i want to search on *one only* tuple field/value."""
"""i will only ever specify an integer match for one tuple field."""
"""the cheque's in the mail"""
"""of course i'll still love you in the morning"""

So augment my pre-built approach by intersection (or union? your
wording is somewhat vague) of the selected answer sets.





More information about the Python-list mailing list