On Mon, May 31, 2021 at 12:36:34PM -0300, André Roberge wrote:

> Thinking some more about it, perhaps the confusion would be sufficiently
> reduced if the repr of '...' would be 'Ellipsis (...)', and use this repr
> to appear in error messages rather than simply the name Ellipsis.

I think you are going against the design of the language here. With only 
a handful of critical exceptional cases (None, True, False are the only 
ones that come to mind), names can be rebound.

    >>> type(4)
    <class 'int'>
    >>> int = list
    >>> type(4)
    <class 'int'>
    >>> int('123')
    ['1', '2', '3']

Objects are not their name, and their name is not the object. Objects do 
not know the name or names they are bound to.

`...` is not a name, it is a syntactic symbol that is hard coded in the 
interpreter to the object which we popularly call "Ellipsis". You can't 
assign to the symbol any more than you can assign to the symbol `+`.

On the other hand, `Ellipsis` is just a name. Like nearly all names in 
Python, you can rebind it or delete it. Rebinding the name doesn't 
affect the object `...`. It still knows itself as Ellipsis, no matter 
what names happen to be bound to it in some namespace or another.

(Analogy: you would probably still think of yourself as André even if we 
all started to call you Bruce.)

We *could* single out Ellipsis for special treatment, like None, True 
and False, but what's so special about Ellipsis that we should bother?

The bottom line here is that the *name* "Ellipsis" is not special. It's 
just a name, like int, TypeError, and all the rest.

If you want to make Ellipsis a keyword, like None, True and False, you 
would need some good reason for it.


-- 
Steve
_______________________________________________
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/DHT3U2ROYZNTP5QNVOKVZ2UNIQ3ODNRX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to