On Tue, Jun 1, 2021 at 6:22 AM Serhiy Storchaka <storch...@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 _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/XT463HNMCJ5KSLQMN2H2B7V4EMWTW5MX/ Code of Conduct: http://python.org/psf/codeofconduct/