I am doing some data massage, minor mapping and filtering really and i
find that i have a lot of this kind of kludgy code:
# -- -------------------------
def filt_seq(inseq):
out_list = []
for item in inseq:
# 38 needs to be mapped on to 34 as we don't have a 38 in our
grid
if item == 38:
item = item - 4
out_list.append(item)
# We also don't have a 40, but we do have a 39. Map that sucka
elif item == 40:
item = item - 1
out_list.append(item)
# if we get values that fall in good places, just pass them on to
the out seq
else:
out_list.append(item)
return out_list
# -- -------------------------
To do some basic jiggering of some out of range off grid data.
There has to be a better, more elegant, more flexible less brute force
more pythonic way to do this kind of mapping no?
cheers,
-kp--
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor