ANNOUNCE: PySymbolic - Doing Symbolics in Python

Alex Martelli aleaxit at yahoo.com
Fri Oct 13 03:34:41 EDT 2000


"Huaiyu Zhu" <hzhu at yahoo.com> wrote in message
news:slrn8ucloq.4id.hzhu at localhost.localdomain...
    [snip]
> >In PySymbolic, Parser.py is an interface to the module `parser'. It just
> >generates more compact and readable lisp-like Python lists.
> >
> >Here follows a simple session with the latest PySymbolic
> >(get it from http://cens.ioc.ee/~pearu/misc/PySymbolic.tgz):
    [snip]
> This looks good, but unfortunately it does not run on my machine, either.

Neither does it run for me, but I least I can easily understand
why -- the package relies on upper/lower case distinction being
significant in matching filenames, and this doesn't work well on
Windows' case-preserving-but-insensitive filesystems.  In other
words, on Windows, you just can't rely on Parser.py and parser.py
being distinguishable files, and therefore parser and Parser
being distinct Python modules, as the current version of Symbolic
does.

So I gave it an editing pass, changing all the references to
Parser to become SymParser (and renaming the module to
SymParser.Py, of course), and now it does work under 2.0
release candidate 1 on Windows, e.g. in PythonWin...:

PythonWin 2.0c1 (#7, Oct  9 2000, 18:44:43) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2000 Mark Hammond (MarkH at ActiveState.com) - see
'Help/About PythonWin' for further copyright information.
>>> import sys
>>> sys.path = [r'd:\Python20\PySymbolic'] + sys.path
>>> from Symbolic import Symbolic
>>> x=Symbolic('x')
>>> x+1
<Symbolic.Symbolic instance at 013E659C>
>>>

and more significantly, Pearu's example now works flawlessly
for me (under the same conditions):

>>> y = x/2 + 4 + 5*x - "2/3*x"
>>> print y
(((x / 2) + 4) + (5 * x)) + (-2 / 3 * x)
>>> print y.simplify()
4 + 29 * x / 6
>>>


Pearu, it's a 10-minute editing job, but, if you want, I'll
zip and send you the edited directory, of course!

Huaiyu, I know that Pearu was testing with 1.5.2, but, might
there be some issues with your current installation...?  Have
you tried it with Release Candidate 1...?  Or maybe you have
an older version of Symbolic.py earlier on sys.path...?


Alex






More information about the Python-list mailing list