Why does print("..."), i.e. three dots in a row, print blank?

Viewed 5311

I'd like to print three dots in a row (to form an ellipsis), but print() prints blank.

print("one moment...")
one moment...
print("...")

print("..")
..
print("...abc...")
abc...
print("\u2026")
…

What's happening here? Why is "..." parsed in an exceptional way?

I am using ipython in PyCharm.

1 Answers

Looks like this is a known issue with Pycharm where its interactive console removes the leading three periods from a print statement. Here’s the ticket tracking this issue.


A possible workaround for now is defining something like:
def iprint(obj):
    if (s:=str(obj)).startswith("..."):
        print('\n'+s)
    else:
        print(s)

which looks like:

>>> iprint("...ymmv")

...ymmv
Related