Working on closing out some bug reports at work, and I ran into one about comparisons to 'None' will result in elementwise object comparison in the future. Now, I totally get the idea behind the change, and I am not here to argue that decision. However, I have come across a situation where the change might have an unexpected negative consequence.
Consider the following:
p = Pool(min(len(tiles), maxprocs))
res = p.map(_wrap_tilesum, izip(repeat(args.varname),
tiles,
repeat(request_start),
repeat(args.timeLen),
repeat(args.srcdir),
repeat(args.tarredInputs),
repeat(args.dataset)))
p.close()
p.join()
(tiles, tile_start_dates, tile_end_dates,
tile_lons, tile_lats) = zip(*res)
if None in tiles:
logging.critical("At least one tile was invalid. Aborting")
raise Exception("Invalid data retrieved!")
Essentailly, in the nominal case, "tiles" would be a list of numpy arrays. However, my error handling is such that if one of my subprocesses errors out, then it returns a None instead of a numpy array. So, all I am doing is testing to see if any of the items in the "tiles" list is None. I have zero desire to actually compare None with the elements in the arrays that happens to be in the list.