[Python-Dev] PEP: __source__ proposal

bearophile bearophileHUGS at lycos.com
Sun Dec 5 10:18:58 CET 2004


(I answer here because I'm still not at easy on python-dev)
It looks like an interesting feature. I think most LOGOs allows
something similar (or better, with a cleaner syntax). The shells of
many versions of this language keep a "pool" of functions defined with
"to" into a kind of database, so you can call them and edit them one
at a time (this is a small block from Wikipedia; note that LOGO allows
to do more than just turtle graphic):

to spiral :size
   if  :size > 30 [stop] ; a condition stop
   fd :size rt 15        ; many lines of action
   spiral :size *1.02    ; the tailend recursive call
end

In Mathematica you can edit "cells" of the interactive document, you
can press enter to go to the next line inside the same cell, and then
you press SHIFT+enter to "compile" and execute the text in the cell
(usually going to the cell that follows the output one).

Some similar "improvements" of the CPython shell can be useful... but
I think you first need to look in many places (Smalltalk, LOGO,
Mathematica, Mathcad, etc.) to find the best ideas to copy from.

Bear hugs,
Bearophile



More information about the Python-list mailing list