Skip to content

Use 4 spaces for indentation in PDB #125377

Closed
@treyhunner

Description

@treyhunner

Feature or enhancement

Proposal:

It looks like PDB evolved the ability to handle multi-line Python expressions in Python 3.13. I didn't see this mentioned in the release notes, but I'm excited to see this feature. Thank you to whoever added this feature! (@gaogaotiantian maybe?)

I did notice that the Tab key works in a somewhat unexpected way.

When I hit Enter at the end of an if True: line, I see:

image

Then if I hit the Tab key I see this:

image

Note that a tab character is inserted (just as one would be within the old Python REPL) but the tab width looks like 2 spaces.

I expected to see this instead:

image

In the old Python REPL, the Tab key used to insert a tab character, but it looked like 4 spaces were inserted because the tab stop happened to be 4 characters from the end of the >>> prompt (which is 4 characters long):

image

One way to resolve this would be to shorten the PDB prompt to something like (P) or PDB .

I would propose instead that the Tab key should insert 4 spaces in PDB (just as the new REPL does).

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Labels

stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions