[Numpy-discussion] Overlap arrays with "transparency"

josef.pktd at gmail.com josef.pktd at gmail.com
Wed May 20 09:24:33 EDT 2009


On Wed, May 20, 2009 at 7:24 AM, Cristi Constantin <darkgl0w at 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