[MATRIX-SIG] Re: [PYTHON MATRIX-SIG] request for idioms

Phil Austin phil@geog.ubc.ca
Tue, 10 Jun 1997 16:26:39 -0700


>>>>> "David" == David Ascher <da@maigret.cog.brown.edu> writes:

    David> I will be giving a tutorial on Numeric Python at SPAM-6,

...

    David>   * things you came up with which map well to constructs
    David> you were used to from other systems (e.g. Matlab, S,
    David> etc.). things which are very python-specific things which
    David> are very cool -- use your own judgment.


One thing that impressed me was Konrad's rewrite of our NumPy-extended
netcdf module.

For our initial attempt, we simply implemented the netcdf C++
interface, which set the origin for an array slice using
set_cur.  Thus to read a 4x3 slice of an array starting a (1,2)
you did:

a=nc.open('demo.nc', nc.WRITE)
b=a.var('temp')
b.set_cur(1,2)
print b.get(4,3)

In contrast, Konrad's module handles it like this:

a=nc.open('demo.nc', nc.WRITE)
b=a.var('temp')
print b[1:5,2:5]

I don't know of another language that let's you pass subscripts to
a C extension in this way.


Regards, Phil

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________