Idle's Shell: prompts and indents (was ...) Idle users please read

wxjmfauth at gmail.com wxjmfauth at gmail.com
Mon Jul 21 16:00:26 EDT 2014


Le lundi 21 juillet 2014 11:00:15 UTC+2, Terry Reedy a écrit :
> On 7/20/2014 11:34 PM, Chris Angelico wrote:
> 
> > On Mon, Jul 21, 2014 at 1:28 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> 
> >> A few users have noticed (and complained) that setting sys.ps1 and sys.ps2
> 
> >> *in the batch mode user process* has no effect. The Idle doc should better
> 
> >> explain why this is and should be.  User code should not affect the
> 
> >> operation of Idle. Idle is separately configured through dialogs.
> 
> >
> 
> > As I understand it, setting them has *absolutely* no effect,
> 
> > currently, right?
> 
> 
> 
> As far as I know, setting sys.ps1 and sys.ps2 have no effect in any 
> 
> batch mode program.  This has nothing to do with Idle.
> 
> 
> 
> > There's no situation in which it would be useful to
> 
> > set them? In that case, it might be useful to put some magic in there
> 
> > (although I'm not sure it's possible; can't use @property at top level
> 
> > in a module) that gives a notification - pointing users to the dialog.
> 
> 
> 
> In general, Idle should execute user code the same way that the 
> 
> interpreter does, subject to the limitations of the different execution 
> 
> environment.
> 
> 
> 
> > No idea how you'd go about it, but telling someone when what s/he does
> 
> > is useless can be helpful.
> 
> 
> 
> What needs better documentation is what the execution environment is, 
> 
> and how the shell is different from a line-buffered console.
> 
> 
-----

Just the coding of characters is making a gui
application different from a console application.

A gui application is living with its own coding,
and not necessarly with the operating system coding.

That's why in my py3* interactive interpreters,
I have (I defined) very correctly things
like this:

>>> sys.stdout.encoding
'<unicode>'
>>> sys.stderr.encoding
'<unicode>'
>>> sys.stdin.encoding
'<unicode>'


The "sys coding" is not the operating system, it
is the "coding of the gui". In Py3, one does
not pass or populate a text widget with an
"encoded string", a string is passed directly as
a "unicode type", because the gui is built to
work like this. Something like an coding-less
string.


In the console ("dos-box"), the following is
correct:

>>> sys.stdout.encoding
'cp1252'

------

Generally, speaking, this is a perpetual annoyment
(to be polite) in Python. Python is always attempting
to find a solution for the "Python user", to enforce a
coding usage instead of letting the user/programmer
doing the task correctly.

I'm not alone to think like this and I have seen
many times people complaining about this.

jmf



More information about the Python-list mailing list