◐ Shell
clean mode source ↗

Message 251514 - Python tracker

> “Else” doesn’t always use a colon. Consider “1 if x else 2”.

Good catch Martin. Unfortunately the completer doesn't take context into account. "else" with a colon is a common case, but unwanted colon could be annoyed. I agree that it would be safe to not append a colon after "else". At least unless we make the completer context aware. However I don't think that unwanted space would be so annoyed. Here is updated patch.

I see that your code does an autocompletion for module names in "import", Martin. This was my next idea. Do you want to provide a patch for including this in CPython?

> I tested the patch. "wi<tab>" displays "with " (space)., but "fo<tab>" displays "for" (no space). I don't understand why.

Because there is "format(".

> IMHO you should apply it to Python 3.4-3.6 (not only 3.6).

This is definitely a new feature. And there is a risk to break something (if standard completer is used programmatic).