[SciPy-dev] ReST tutorial - where should it go?
Stéfan van der Walt
stefan at sun.ac.za
Fri May 15 06:17:39 EDT 2009
2009/5/15 Matthew Brett <matthew.brett at gmail.com>:
> I sense some gentle South African teasing here, but I'm too tired to
> understand, so I say:
>
> Great - glad I taught you something new about structs!
Always so suspicious of the former colonies! :)
But no, I was being serious: thanks for all your work on scipy.io and
for writing the tutorial!
I was surprised, because I thought the Octave structure:
octave:2> s = struct('foo', 1, 'bar', 2)
s =
{
foo = 1
bar = 2
}
would be read in by SciPy to a variable x that could be accessed:
x.foo and x.bar
In the tutorial I saw that you had to use
x[0, 0].foo and x[0, 0].bar
instead, which didn't make sense to me, mainly because in the 3 years
since I last used Octave I forgot that one could do:
octave:4> s = struct('foo', {1, 2}, 'bar', {4, 5})
s =
{
foo =
(,
[1] = 1
[2] = 2
,)
bar =
(,
[1] = 4
[2] = 5
,)
}
In Octave you then see that
octave:6> size(s)
ans =
1 2
octave:7> s(1, 1)
ans =
{
bar = 4
foo = 1
}
after which the way SciPy indexes the data makes a lot more sense!
Enjoy the weekend!
Stéfan
More information about the SciPy-Dev
mailing list