In code, list.clear doesn't throw error - it's just ignored

avi.e.gross at gmail.com avi.e.gross at gmail.com
Tue Nov 15 19:10:23 EST 2022


Yes, Chris, that is a REPL feature and one that people may use
interactively.

As you note, it does not work inside something like a function which the
REPL is not trying to evaluate and print. So clearly my supposed use would
not make much sense in such code.


-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com at python.org> On
Behalf Of Chris Angelico
Sent: Tuesday, November 15, 2022 6:16 PM
To: python-list at python.org
Subject: Re: In code, list.clear doesn't throw error - it's just ignored

On Wed, 16 Nov 2022 at 10:11, <avi.e.gross at gmail.com> wrote:
>
> That is clear, Cameron, but on my python interpreter values evaluated 
> on the command line ARE saved:
>
> >>> numb = 5
> >>> 5 + numb
> 10
> >>> numb
> 5
> >>> _ + _ + 1
> 11

That's a REPL feature.

ChrisA
--
https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list