[Python-Dev] At the interactive port (original) (raw)
Guido van Rossum guido@python.org
Mon, 01 May 2000 18:17:17 -0400
- Previous message: [XML-SIG] Re: [I18n-sig] Re: [Python-Dev] Unicode debate
- Next message: [Python-Dev] At the interactive port
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Continuing the recent debate about what is appropriate to the interactive prompt printing, and the wide agreement that whatever we decide, users might think otherwise, I've written up a patch to have the user control via a function in builtin the way things are printed at the prompt. This is not patches@python level stuff for two reasons:
1. I'm not sure what to call this function. Currently, I call it printexpr, but I'm not sure it's a good name 2. I haven't yet supplied a default in builtin, so the user must override this. This is unacceptable, of course. I'd just like people to tell me if they think this is worth while, and if there is anything I missed.
Thanks for bringing this up again. I think it should be called sys.displayhook. The default could be something like
import builtin def displayhook(obj): if obj is None: return builtin._ = obj sys.stdout.write("%s\n" % repr(obj))
to be nearly 100% compatible with current practice; or use str(obj) to do what most people would probably prefer.
(Note that you couldn't do "%s\n" % obj because obj might be a tuple.)
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [XML-SIG] Re: [I18n-sig] Re: [Python-Dev] Unicode debate
- Next message: [Python-Dev] At the interactive port
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]