Two-Dimensional Expression Layout
Lawrence D’Oliveiro
lawrencedo99 at gmail.com
Sun Aug 21 00:26:08 EDT 2016
On Sunday, August 21, 2016 at 12:44:21 PM UTC+12, Michael Selik wrote:
>
> On Sat, Aug 20, 2016 at 6:21 PM Lawrence D’Oliveiro wrote:
>
>>> if any(not isinstance(obj, Image) for obj in [src, mask, dest]):
>>> ...
>>
>> Spot the bug in your version...
>
> - ``mask != None`` is unnecessary, unless somehow None has been registered
> as an instance of Image.
That’s the bug: it’s not unnecessary.
Maybe a quick application of one of De Morgan’s theorems might help:
if (
isinstance(src, Image)
and
(mask == None or isinstance(mask, Image))
and
isinstance(dest, Image)
) :
don’t raise TypeError("image args must be Image objects")
#end if
Is that better for you?
More information about the Python-list
mailing list