Skip to content

_ should be reassigned after command execution #132505

@ngudbhav

Description

@ngudbhav

Bug report

Bug description:

This is a snippet from the python REPL.

>>> "abc"
'abc'
>>> _
'abc'
>>> _ = "bcf"
>>> _
'bcf'
>>> "abc"
'abc'
>>> _
'bcf'
>>> ››

Python allows overriding _ as a variable. If this is overridden, there seems to be no way to return to the previous default behaviour. If there is, please correct and suggest.

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shelltype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions