One other note that I'm surprised hasn't been brought up:

In another thread, there is a discussion about what to use as sentinel objects -- often to indicate non-specified parameters, when None is a valid value. 

A number of people have proposed using the ellipses as such a value, as it already exists, is built in, is a singleton, has only specialized uses at the moment in different contexts, and is a good mnemonic for "missing".

Apparently a number of people already use it that way.

If Ellipses that does become a standard recommend sentinel object -- that might be a motivator for making it a special word, like None.

However, I"m still a bit confused as to why the rep of the ellipses object isn't it's literal already. Is there any other example of this?

In [1]: repr(list())
Out[1]: '[]'

In [2]: repr(dict())
Out[2]: '{}'


Hmm -- there is set:

In [3]: repr(set())
Out[3]: 'set()'

which breaks eval if you rebind it.

Though it doesn't use the name if it's not empty:

In [16]: s = {1,2,3}

In [17]: repr(s)
Out[17]: '{1, 2, 3}'

In the end, I think this is an argument for not using ellipses as a standard sentinel, rather than an argument for making "Ellipses" more special.

-CHB



On Tue, Jun 1, 2021 at 4:33 AM Steven D'Aprano <steve@pearwood.info> wrote:
On Tue, Jun 01, 2021 at 08:28:56PM +1000, Steven D'Aprano wrote:

> One easy change would be to just drop the capital E and call it
> "ellipsis" (without the quotes), or even "the ellipsis symbol". To my
> mind, that makes it clear we're talking about the symbol, not the
> builtin name.

https://bugs.python.org/issue44278

Thanks Serhiy!

--
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/MRCYKQODI2FYG6AYFRBS3PBMQCBWRONL/
Code of Conduct: http://python.org/psf/codeofconduct/


--
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython