[SciPy-dev] pynotes

Prabhu Ramachandran prabhu_r at users.sf.net
Mon Nov 8 03:24:21 CST 2004

>>>>> "AB" == Arnd Baecker <arnd.baecker at web.de> writes:

    AB> Hi Prabhu, On Mon, 8 Nov 2004, Prabhu Ramachandran wrote:

    >> 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

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

Ahh, I did not realize the problem with the text editor.  That is a
good enough point to shelve the dictionary.

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

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

Well, what if the version changes, or the path to the file changes
(like you install the default rpm/deb and then upgraded to a source
install in /usr/local) or if the version of Python changes.  But then
again if you made the paths using only module names rather than the
__file__ then this would work fine I guess.

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

I agree.

    AB> To elaborate a bit more on the `ufunc` problem: 

Yes, that is a problem. /the only solution I know is to use a separate
ufunc directory and treat all names as common to anything that is a
ufunc.  Is there any reason numarray's cos function will be documented
any different from Numeric's?

BTW, instead of using the full path why not strip everything before
the site-packages (for the __file__) because it eliminates the problem
with versioning and relocating the package to /usr/local etc.


More information about the Scipy-dev mailing list