[Numpy-discussion] extension questions: f2py and cython

Robin robince@gmail....
Thu Oct 15 13:01:43 CDT 2009


Hi,

Thanks

On Thu, Oct 15, 2009 at 4:10 PM, Andrew Hawryluk <HAWRYLA@novachem.com> wrote:
>> But I have some questions. It seems to work as is, but I don't set c
> to
>> zeros anywhere. Can I assume arrays created by f2py are zero?
>
> As I understand it, uninitialized variables in Fortran are
> compiler/system-dependent. Some compilers initialize values to zero,
> many leave the previous contents of the memory in place. It is safest to
> never use the value of an uninitialized variable.

But in this case I understood it was initialised or created by the
f2py wrapper first and then passed to the fortran subroutine - so I
wondered how f2py creates it (I think I traced it to
array_from_pyobj() but I couldn't really understand what it was doing
or whether it would always be zeros). I guess as you say though it is
always safer to initialize explicitly

Cheers

Robin


More information about the NumPy-Discussion mailing list