On Sunday, August 21, 2016 at 12:48:46 AM UTC+12, Michael Selik wrote: > > On Fri, Aug 19, 2016 at 5:01 AM Lawrence D’Oliveiro wrote: > >> It is handy to be able to keep complex expressions together sometimes, >> when breaking them up would simply obscure their structure. > > p0 = (0, 0) > p1 = (major_dim, 0) > colour_stops = (0, rect_1_colour), (1, complement(rect_1_colour)) > rect_1_pattern = qah.Pattern.create_linear(p0, p1, colour_stops)
That’s an example of what I mean about obscure structure. >> From <https://github.com/ldo/python_pixman/blob/master/pixman.py>, a >> complex condition (with redundant parentheses again): >> >> if ( >> not isinstance(src, Image) >> or >> mask != None and not isinstance(mask, Image) >> or >> not isinstance(dest, Image) >> ) : >> raise TypeError("image args must be Image objects") >> #end if >> > > No need for the separate calls to isinstance, nor the check for None. > > if any(not isinstance(obj, Image) for obj in [src, mask, dest]): > ... Spot the bug in your version... -- https://mail.python.org/mailman/listinfo/python-list