Two-Dimensional Expression Layout

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Fri Aug 19 17:30:09 EDT 2016


On Saturday, August 20, 2016 at 7:52:09 AM UTC+12, codew... at gmail.com wrote:
>     if any([
>         not isinstance(src, Image),
>         mask != None and not isinstance(mask, Image),
>         not isinstance(dest, Image),
>     ]):
>         raise TypeError("image args must be Image objects")
> 
> Or equivalently:
> 
>     if not all([
>         isinstance(src, Image),
>         mask is None or isinstance(mask, Image),
>         isinstance(dest, Image),
>     ]):
>         raise TypeError("image args must be Image objects")

Using “all” or “any” in this sort of situation may not be such a good idea. More reasonable uses would be like <https://developer.blender.org/diffusion/BAC/browse/master/io_export_paper_model.py>:

    if any(uvface.flipped for uvface in island.faces):

    if any(island.bounding_box.x > cage_size.x or island.bounding_box.y > cage_size.y for island in self.islands):



More information about the Python-list mailing list