Re: python3, tabs, and Terminal

2022-10-12 Thread Langer, Stephen A. (Fed) via macports-users
Thank you!  I should have thought to google "readline".

 -- Steve


-Original Message-
From: macports-users  on behalf of 
Joshua Root 
Date: Wednesday, October 12, 2022 at 6:17 PM
To: "macports-users@lists.macports.org" 
Subject: Re: python3, tabs, and Terminal

On 2022-10-13 08:05 , Joshua Root wrote:
> Langer, Stephen A. (Fed) wrote:
> 
>> I don’t know if I have something wrong in my settings or expectations, 
>> or if this is a bug.  Typing a tab in an Apple Terminal window while 
>> using any version of Python3 from MacPorts makes the terminal enter 
>> some kind of editing mode, instead of just indenting the line.  
>> Python2 from MacPorts doesn't do this, and neither does Python3 from 
>> Apple, which makes me think that it's some kind of Python 
>> configuration issue in MacPorts.  The same thing happens when using 
>> iTerm2.
>>
>> For example:
>>
>> % python3
>> Python 3.8.15 (default, Oct 12 2022, 03:09:36)
>> [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>>/def f(): / <--- anything typed here brings up old lines 
>> from other sessions, when I just want to indent
> Do you see this with newer python versions? I don't see it in 3.10, 
> FWIW. I remember there were some bugs with libedit support in older 
> versions.
> 
> You can try installing py38-gnureadline, which will override the 
> built-in readline module.
> 
> - Josh
> 

Turns out this is a feature: 

<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.python.org%2F3%2Flibrary%2Fsite.html%23rlcompleter-configdata=05%7C01%7Cstephen.langer%40nist.gov%7C1a0e3453f45e4f8aef1c08daac9f84b3%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638012098373708017%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=sZEqXdM2EUdaJAXyY%2FrOSWPHS61IbV1Eu%2Frk7JMiUbg%3Dreserved=0>

- Josh



Re: python3, tabs, and Terminal

2022-10-12 Thread Joshua Root

On 2022-10-13 08:05 , Joshua Root wrote:

Langer, Stephen A. (Fed) wrote:

I don’t know if I have something wrong in my settings or expectations, 
or if this is a bug.  Typing a tab in an Apple Terminal window while 
using any version of Python3 from MacPorts makes the terminal enter 
some kind of editing mode, instead of just indenting the line.  
Python2 from MacPorts doesn't do this, and neither does Python3 from 
Apple, which makes me think that it's some kind of Python 
configuration issue in MacPorts.  The same thing happens when using 
iTerm2.


For example:

% python3
Python 3.8.15 (default, Oct 12 2022, 03:09:36)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>/def f(): / <--- anything typed here brings up old lines 
from other sessions, when I just want to indent
Do you see this with newer python versions? I don't see it in 3.10, 
FWIW. I remember there were some bugs with libedit support in older 
versions.


You can try installing py38-gnureadline, which will override the 
built-in readline module.


- Josh



Turns out this is a feature: 



- Josh


Re: python3, tabs, and Terminal

2022-10-12 Thread Joshua Root

Langer, Stephen A. (Fed) wrote:


I don’t know if I have something wrong in my settings or expectations, or if 
this is a bug.  Typing a tab in an Apple Terminal window while using any 
version of Python3 from MacPorts makes the terminal enter some kind of editing 
mode, instead of just indenting the line.  Python2 from MacPorts doesn't do 
this, and neither does Python3 from Apple, which makes me think that it's some 
kind of Python configuration issue in MacPorts.  The same thing happens when 
using iTerm2.

For example:

% python3
Python 3.8.15 (default, Oct 12 2022, 03:09:36)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>/def f(): / <--- anything typed here brings up old lines from 
other sessions, when I just want to indent
Do you see this with newer python versions? I don't see it in 3.10, 
FWIW. I remember there were some bugs with libedit support in older 
versions.


You can try installing py38-gnureadline, which will override the 
built-in readline module.


- Josh



python3, tabs, and Terminal

2022-10-12 Thread Langer, Stephen A. (Fed) via macports-users
Hi --

I don’t know if I have something wrong in my settings or expectations, or if 
this is a bug.  Typing a tab in an Apple Terminal window while using any 
version of Python3 from MacPorts makes the terminal enter some kind of editing 
mode, instead of just indenting the line.  Python2 from MacPorts doesn't do 
this, and neither does Python3 from Apple, which makes me think that it's some 
kind of Python configuration issue in MacPorts.  The same thing happens when 
using iTerm2.

For example:

% python3 
Python 3.8.15 (default, Oct 12 2022, 03:09:36) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
 <--- anything typed here brings up old lines from other sessions, 
when I just want to indent

Is there a way to get around this problem, other than typing spaces instead of 
tabs, or not running Python interactively?  If this is a feature, is it 
documented?

Thanks.
 -- Steve