[Matrix-SIG] Fortran-to-python-interface-generator: looking foropinions
Perry A. Stoll
pas@scansoft.com
Fri, 27 Aug 1999 16:40:13 -0400
Pearu wrote:
> subroutine sub
> integer i,j
> common /cblock1/ i,j
> j=i
> end
>In python
> import test
> test.cblock1_i_set(5)
> test.sub()
> print test.cblock1_j_get()
>would print '5'
>
>If you can think of more natural way in seeing common blocks from python,
>I would like to know as the above is just first solution that I
>thought of.
How about creating a CommonBlock object that uses __getattr__, __setattr__
to check for the appropriate attributes. Then the above could look like:
> import test
> test.cblock1.i = 5
> print test.cblock1.j
5
-Perry