On Thu, Feb 19, 2015 at 02:03:41PM -0500, Ilia Mirkin wrote: > On Thu, Feb 19, 2015 at 12:59 PM, Dylan Baker <[email protected]> wrote: > >> + return -1.0 if any(ret['badlands']) else map(float, > >> ret['component_tolerances']) > > > > Generally at this point python (both upstream and community) discourage > > the use of map and filter, with a preference for comprehensions. > > [float(x) for x in ret['component_tolerances']] should be what you want. > > Just to provide a counterpoint, I think that > > map(float, fooarray) > > is a ton more readable than > > list(float(x) for x in fooarray)
I agree that list(generator) is ugly, which is why I suggested a list comprehension, and not a generator comprehension. > > That said, once you start moving to a lambda function, the map loses > its appeal in improved readability. Similar rationale for filter. > > -ilia
signature.asc
Description: Digital signature
_______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
