Open pesekon2 opened 1 year ago
Actually, should rethink this. Listcomps are faster than genexps unless you are doing any()
and expect Falseto happen
early`. Should be used only when memory is ore important than speed.
The same applies to tuples created from listcomps:
> ag "tuple.*\[.*for.*in"
python/grass/pygrass/vector/geometry.py
1142: self.append(tuple([float(e) for e in coord.split(" ")]))
python/grass/pygrass/vector/testsuite/test_vector.py
39: coords = tuple([pnt.coords() for pnt in vect[:3]])
41: coords = tuple([pnt.coords() for pnt in vect[1:3]])
python/grass/pygrass/raster/buffer.py
7:CELL = tuple([getattr(np, attr) for attr in _CELL if hasattr(np, attr)])
9:FCELL = tuple([getattr(np, attr) for attr in _FCELL if hasattr(np, attr)])
11:DCELL = tuple([getattr(np, attr) for attr in _DCELL if hasattr(np, attr)])
python/grass/script/db.py
194: result = [tuple(x.rstrip(os.linesep).split(args["sep"])) for x in ofile.readlines()]
gui/wxpython/core/settings.py
75: return tuple(int(hexcode[i : i + 2], 16) for i in range(0, len(hexcode), 2))
gui/wxpython/animation/provider.py
635: cmdTuple[1]["bgcolor"] = bgcolor = ":".join([str(part) for part in bgcolor])
scripts/d.rast.leg/d.rast.leg.py
107: f = tuple([float(x) for x in s.split()])
Probably not all, but at least some should be possible, saving memory: