
On Tue, Jun 1, 2021 at 6:22 AM Serhiy Storchaka <storchaka@gmail.com> wrote:
31.05.21 22:46, Chris Angelico пише:
Originally, the notation "..." could only be used inside a subscript, and anywhere else, you'd have to spell it "Ellipsis". Now that you can use "..." anywhere, would it be worth switching the repr to just be that?
How would you then distinguish a recursive list from a list containing Ellipsis?
a = []; a.append(a); a [[...]] [[...]] [[Ellipsis]]
Good point, didn't think of that. Although... since that's an arbitrary placeholder, it could be changed to pretty much anything. Maybe <...> or something? The current repr may not technically be ambiguous, but it will silently do the wrong thing if you try to eval it. You can even ast.literal_eval(repr(a)) and it'll appear to work. Not a huge deal whichever way, though. The token "..." is used in a variety of non-ellipsis ways, such as doctest, and that isn't inherently a problem. ChrisA