[f2py] Some questions about signatures
Tue, 19 Feb 2002 22:32:06 +0200 (EET)
On 19 Feb 2002, Lionel Maziere wrote:
> If I edit the signature file and change all 'character*(9)' occurences
> to 'character*36' and use it from python with an array of size 36, it
> works just fine.
> Why is this seen as 'character*(9)' in the signature ?
It is a f2py bug, I guess. f2py does not currently support
multi-dimensional character arrays as one would like. The reason is
that there is no corresponding concept in Python (well, almost,
f2py could use multi-dimensional Numeric arrays). So, from Python all
character arrays are seen as a single character array. In future, this
will be fixed.
> Why couldn't I force it with a cf2py statement as :
> 'cf2py character*36 intent(in,out)' ?
Did you try? You may need to put the following line _before_ the
'CHARACTER*4 NM(9)' statement:
cf2py character*36 intent(in,out) :: NM
> I wouldn't want commons to be seen from python, so I edit the signature
> file to remove them, couldn't there be an option or some other way to
> prevent commons to be included in signature file ?
I see your point. I'll look for adding the corresponding option.
Did you tried
> Other problem :
> If 'cf2py' directives in fortran files are insufficient to resolve above
> problems, I must edit the .pyf. Then I would like to keep it and not
> generate it at each build. But the Makefile-'module' is generated at the
Don't use Makefile files for building extension modules. Use e.g.
f2py -c foo.pyf *.f
for building. There is no support for f2py generated Makefiles
anymore. Yes, I know, I have to update docs...