CARVIEW |
CLPython - an implementation of Python in Common Lisp
CLPython is an implementation of the Python programming language in Common Lisp.
Currently, many Python language features are already implemented: basic data types,
functions, classes, metaclasses, generators, closures. Some recently introduced features
are still missing.
Integration of CLPython with Lisp and existing Lisp libraries is still in progress.
See Current Status for details.
There is a mailing list for general discussion and reporting of bugs:
clpython-devel.
To be informed about new releases, please subscribe to clpython-announce.
CLPython is developed by Willem Broekema with
support from Franz Inc.
CLPython is released under the LLGPL.
Running CLPython
CLPython currently requires Allegro Common Lisp 8.0; the Express version should be okay.
The source code is in a public CVS repository. To grab it:
cvs -d :pserver:cvspublic@cvspublic.franz.com:/cvs-public login (use password: cvspublic) cvs -d :pserver:cvspublic@cvspublic.franz.com:/cvs-public checkout clpython
You can load CLPython using asdf First create two symlinks from the asdf registry (the value of asdf:*central-registry*) to clpython.asd and clpython-app.asd. Then, assuming you have loaded asdf:
(asdf:operate 'asdf:load-op 'clpython) (asdf:operate 'asdf:load-op 'clpython-app)
This results in compilation and loading of all CLPython files.
After that, you can start the CLPython REPL by running the read-eval-print loop:
:pa clpython.app.repl (repl)
It looks like this:
CLPYTHON.APP.REPL(7): (repl) [CLPython -- type `:q' to quit, `:help' for help] >>> import sys #<builtin module `sys' @ #x108592a2> >>> def f(): ... print "Powered by %s" % sys.platform ... #<python-function f @ #x1090595a> >>> f() Powered by Common Lisp None >>> f #<python-function f @ #x1090595a> >>> (time (funcall _)) Powered by Common Lisp ; cpu time (non-gc) 0 msec user, 0 msec system ; cpu time (gc) 0 msec user, 0 msec system ; cpu time (total) 0 msec user, 0 msec system ; real time 0 msec ; space allocation: ; 10 cons cells, 2,032 other bytes, 0 static bytes#<PY-NONE @ #x106aa30a> >>>
In the repl you can execute arbitrary Python statements.
To import the file /foo/bar/baz.py, first add its directory to sys.path, like: import sys; sys.path.append("/foo/bar"); import baz.
See Documentation? for more help.
Background
Python is both a programming language and the name of the reference implementation; the implementation is sometimes called "CPython" to differentiate the two. Some other implementations are Jython (Java) and IronPython (C# on .NET/Mono). Each of these implementations has platform-specific features. For example, Jython offers a nice integration between Python and Java classes and other data types. CLPython is in the same league, offering integration between Python and Lisp of both language and libraries.
The main dependencies on Allegro CL are yacc and environments. Supporting other Lisp environments is a goal, but unless more people get involved it will probably not happen soon.
Links
CLPython...
- in the news (Technorati)
- in the Common Lisp Directory (CL-User.net)
Download in other formats:

Powered by Trac 0.9.4
By Edgewall Software.
Visit more Common Lisp projects at
https://common-lisp.net/