Confusing […] List in Python: What is it?

前端 未结 9 2167
傲寒
傲寒 2020-11-29 10:52

So I was writing up a simple binary tree in Python and came across [...]

I don\'t believe this to be related to the Ellipsis object, more it seems to have something

9条回答
  •  误落风尘
    2020-11-29 11:35

    EDIT: As mentioned above, this isn't the Ellipsis object, but the result of a looped list. I jumped the gun here. Knowing about the Ellipsis object is a good bit of back shelf knowledge should you find an Ellipsis in some actual code, rather than the output.


    The Ellipsis object in Python is used for extended slice notation. It's not used in current Python core libraries, but is available for developers to define in their own libraries. For example, NumPy (or SciPy) use this as part of their array object. You'll need to look at the documentation for tree() to know exactly how Ellipsis behaves in this object.

    From Python documentation:

    3.11.8 The Ellipsis Object

    This object is used by extended slice notation (see the Python Reference Manual). It supports no special operations. There is exactly one ellipsis object, named Ellipsis (a built-in name).

    It is written as Ellipsis.

提交回复
热议问题