Two-Dimensional Expression Layout
Lawrence D’Oliveiro
lawrencedo99 at gmail.com
Fri Aug 19 18:31:01 EDT 2016
On Saturday, August 20, 2016 at 9:56:05 AM UTC+12, codew... at gmail.com wrote:
>
> On Friday, August 19, 2016 at 5:30:22 PM UTC-4, Lawrence D’Oliveiro wrote:
>
>> 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.
>
> Would you care to elaborate?
There is no short-cut evaluation when constructing tuples and lists.
More information about the Python-list
mailing list