How can I make a function equal to 0?
Martin Manns
mmanns at gmx.net
Fri Mar 21 19:06:41 EDT 2008
On Fri, 21 Mar 2008 14:51:49 -0700 (PDT)
Gabriel Genellina <gagsl-py2 at yahoo.com.ar> wrote:
> > If I fill the array with 0 instead of the functions that
> > return "" this works really fast.
> >
> > However, I would like to be able call the content of each
> > cell in the array as a function.
>
> If you drop this condition then you could fill the array with zeroes
> as before, replace only the interesting ones with actual functions,
> and write:
>
> for item in myarray[nonzero(myarray)]:
> print item() if callable(item) else item
Works for me.
Thank you
Martin
More information about the Python-list
mailing list