Data mapper - need to map an dictionary of values to a model
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Tue Jan 15 14:27:04 EST 2008
Luke:
> I'm not familiar with this pattern. I will search around, but if you
> have any links or you would like to elaborate, that would be
> wonderful. :)
It's not a pattern, it's a little thing:
def line_filter(filein, params):
for line in filein:
if good(line, params):
yield extract(line, params)
That equals to this too:
def line_filter(filein, params):
return (extract(line, params) for line in filein if good(line,
params))
But probably that's not enough to solve your problem, so other people
can give you a better answer.
Bye,
bearophile
More information about the Python-list
mailing list