On Sun, 27 Jan 2013, Sven Schreiber wrote:
Am 27.01.2013 17:47, schrieb Allin Cottrell:
> Giving the user the choice of "as" would be a bit fiddly,
> since we need the numpy namespace for basic I/O. But maybe a
> python guru could suggest a way to conditionalize our calls
> to the numpy functions? If so, I'd suggest the invocation
> might be
>
> language=python --numpy="np"
Well I don't want to call myself a guru, especially given the few hours
I have spent with Python in recent months/years, but the namespace alias
is optional. So you can always do 'import numpy' and then just use
'numpy.loadtxt' etc. For the few functions that gretl uses for it's
tricks behind the scenes you could also write:
'from numpy import loadtxt, savetxt'
without having to specify any new namespace label, then you just use
'loadtxt' and 'savetxt' directly (which is bad style in bigger contexts,
but here I think it should be ok). It's no problem to do both this
'from' form for gretl's own needs, and then 'import numpy as
<whatever>'
for further use by the user in the foreign block.
OK, that sounds like a good approach.
Allin