Skip to content

Conversation

tanloong
Copy link
Contributor

@tanloong tanloong commented May 8, 2025

@gaogaotiantian
Copy link
Member

I'm aware of this issue when I wrote the feature, but this is not the proper way to solve it. I did not do it in the first place because of the actual usage of this feature - when the user types in a function, it's normally a temporary function that's relatively simple. It would be very rare for users to type in some inline comments after :.

If we consider the "problem" of this rare case - it's not too bad, they just need to indent manually and it takes one more click. This PR tries to parse the string, which will almost never be correct. For example, what if it's part of a multi-line string?

So, my take for this "issue" is, we either make it simple to understand and maintain, even though it makes small acceptable mistakes in some rare cases, or we solve it for good, making it correct in all cases, with some reasonable complexity.

I don't think this PR falls into those two categories, it made the code significantly more complicated, while still leave some dark corner uncovered.

Also, in the future, when PyREPL is stable and ready to be used in other applications, I'd like to port pdb's front-end to it, so it has the real multiline editing capability. When that time comes, this code will be removed anyway.

For the reasons above, I don't think pdb should take this change, unless other core devs have strong opposite opinions.

@tanloong
Copy link
Contributor Author

tanloong commented May 8, 2025

Fair enough. Thank you for your elaborate explanation!

@tanloong tanloong closed this May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants