[Numpy-discussion] Overlap arrays with "transparency"

josef.pktd@gmai... josef.pktd@gmai...
Wed May 20 08:24:33 CDT 2009


On Wed, May 20, 2009 at 7:24 AM, Cristi Constantin <darkgl0w@yahoo.com> wrote:
> Thank you for your help. :)
>
> I used this :
> try: NData[ (NData==transparent)[:len(OData)] ] = OData[ (NData==transparent)[:len(OData)] ]
> except: pass
>
> That means overwrite all "transparent" data from NData with valid data from
> OData.
> I am sure it's not the best method yet, but it's the only one that works.
>

just some quick comments:

If you assign (NData==transparent)[:len(OData)]  to a temporary
variable, then you don't need to calculate this twice.
It would save a bit of time.

Catching all exceptions with ``except: pass``  is definitely discouraged.

Josef


More information about the Numpy-discussion mailing list