以后遇到这种疑问,可以先去查一下 `...` 的含义:
https://docs.python.org/3/library/constants.html#Ellipsis`...` 是个常量对象,在你这种场景下,换成 123 效果也一样。
$ python3 -c 'a = ...; print(a)'
Ellipsis
$ python3 -c 'help(...)'
Help on ellipsis object:
class ellipsis(object)
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.