matching objects by a tuple field criterion
bullockbefriending bard
kinch1967 at gmail.com
Sun Jun 10 07:55:38 EDT 2007
More information about the Python-list mailing list
Sun Jun 10 07:55:38 EDT 2007
- Previous message (by thread): matching objects by a tuple field criterion
- Next message (by thread): matching objects by a tuple field criterion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Instead of passing a wild-card tuple like (*,*,*,4,*,*) simply pass the > integer you want to match and the position you want to match it in. for sure. that was more for expository purpose rather than how i was planning to go about it. > As a generator expression: > > (obj for obj in list_of_objects if obj.data[what] == where) above or equivalent list comprehension was what i had in mind as far as linear search goes. and scanning the list like this will most likely be 'good enough' performance-wise. however, partly just out of curiosity, i was wondering if there is some kind of data structure which might let me find all the matches a bit faster.
- Previous message (by thread): matching objects by a tuple field criterion
- Next message (by thread): matching objects by a tuple field criterion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list