Skip to content

Commit

Permalink
Added Jython solution
Browse files Browse the repository at this point in the history
Added abstract interface specification.
(Motivation is in the abstract)
  • Loading branch information
Moshe Zadka committed Nov 2, 2000
1 parent 769523d commit 4de2874
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions pep-0217.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ Abstract
Python, so users will have control over the output from the
interactive interpreter.

Interface

The current Python solution has worked for many users, and this
should not break it. Therefore, in the default configuration,
nothing will change in the REPL loop. To change the way the
interpreter prints interactively entered expressions, users
will have to rebind sys.displayhook to a callable object.
The result of calling this object with the result of the
interactively entered expression should be print-able,
and this is what will be printed on sys.stdout.

Solution

The bytecode PRINT_EXPR will call sys.displayhook(POP())
Expand All @@ -30,16 +41,13 @@ Solution
def displayhook(o):
if o is None:
return
__builtin__._ = None
print `o`
__builtin__._ = o
print o

Jython Issues

The author knows too little about Jython, but it is very important
to be compatible with it. displayhook will have to be added to sys,
but since Jython works with Java bytecodes, the compiler would have
to be changed too, or maybe not.
Barry?
The method Py.printResult will be similarily changed.


Local Variables:
Expand Down

0 comments on commit 4de2874

Please sign in to comment.