[SciPy-dev] pynotes

Arnd Baecker arnd.baecker at web.de
Mon Nov 8 03:02:07 CST 2004


Hi Prabhu,

On Mon, 8 Nov 2004, Prabhu Ramachandran wrote:

> Hi,
>
> This sounds like a very cool feature.

Thanks!

> I just have one suggestion.
> Rather than creating a nested structure of folders with the added
> notes,

I am also not 100% happy with this, but there are a
few reasons in favour (see below).

> why not save everything in a dictionary with the keys being the
> fully-qualified module name or alternatively the full path to the
> file?  If you want more fine-grained docs, you could nest dictionaries
> within the dictionary.  This is extremely easy to deal with
> programmatically

This sounds very appealing, and a simple pickle would
allow storing/reading. Presumably one has to store
every time something was added to make sure that
on a crash newly added information is not lost.
Then one has to find a way to get new texts from the editor
into the dictonary. And also the other way round when
one wants to make changes to an existing entry this
has to be passed on to the editor. In both cases
a temporary file might be needed.
Maybe I am seeing complications where there aren't any,
but this is definitively worth discussing.

> and *to me* seems to solve some of your problems.

Maybe I am missing something here, but from my point of
view the only remaining problem is to
get a unique path to `ufuncs`.
I don't see how storing in a dictionary will overcome
this - sorry if I am just blind.

There is another reason why I like the file-based approach:
one can easily make additions, even after the end
of a python session, just using the editor.
One could also think of using ReST with "links" to figures
which one could easily put into the corresponding directory.
Somehow I feel that by this such notes could grow more easily
than with the dictionary approach.

Anyway, I think it is  important to discuss the details
at this stage!
I am also having the livedocs in mind which could
be stored in just the same way.
This would mean we have a
  /usr/share/doc/python2.3-scipy/pynotes/
which contains a copy of the livedocs-tree
and the user-specific
  ~/.pynotes
Both are tested for additional information when
displaying a help topic.
((And there is nothing preventing to have several more
note trees (like working group specific ones etc.).))

To elaborate a bit more on the `ufunc` problem:
In [1]: import Numeric
In [2]: Numeric.cos?
Type:           ufunc
String Form:    <ufunc 'cos'>
Namespace:      Interactive
Docstring:
    cos(x) returns array of elementwise cosines.
In [3]: Numeric.cos
Numeric.cos.accumulate  Numeric.cos.reduce
Numeric.cos.outer       Numeric.cos.reduceat

There is no attribute telling me that cos came from Numeric.
If that was know, the rest would be easy:
In [4]: Numeric.__file__
Out[4]: '/usr/lib/python2.3/site-packages/Numeric/Numeric.pyc'
So the resulting path would be
  /usr/lib/python2.3/site-packages/Numeric/Numeric/cos.txt
((BTW: numarry makes it easier:
In [7]: numarray.cos.__module__
Out[7]: 'numarray.ufunc'
)

I tried several inspect commands on Numeric.cos, but
without success....

Of course, there might be other objects where one cannot
easily associate a path, but I am not aware of
any yet...;-)

Thanks for you feedback!

Arnd




More information about the Scipy-dev mailing list