5

I saw this ellipsis / three dot operator in aiohttp:

    if debug is ...:
        debug = loop.get_debug()
  • What is it called, and what does it do?
  • Is it some sort of destructuring, or spread operator?
  • And how does it differ from **some_kwargs and *some_args ?

solution

In this particular instance:

>>> ...
Ellipsis
>>> x = Ellipsis
>>> x is ...
True
>>> ... is ...
True

Code:

Community
  • 1
  • 1
jmunsch
  • 22,771
  • 11
  • 93
  • 114
  • 1
    I read here, but not sure I can relate to the above code: http://stackoverflow.com/questions/772124/what-does-the-python-ellipsis-object-do – Jean-François Fabre Jan 01 '17 at 21:20
  • Awesome thanks! searching with keywords is difficult. – jmunsch Jan 01 '17 at 21:21
  • You may also want to look into [How much research effort is expected of stack overflow users?](http://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users) – Christian Dean Jan 01 '17 at 21:22
  • This could be a Q/A on it's own. The question referred to prove duplicateness uses Ellipsis in a syntactically different way. Good to know ellipsis can be also used directly. – Roman Susi Jan 01 '17 at 21:26
  • @RomanSusi Yes, but the linked duplicate _also_ includes several links about Ellipsis, and, all in all, I believe that it provides sufficient resources to learn more. – Christian Dean Jan 01 '17 at 21:32
  • @RomanSusi -- `Ellipsis` is able to be used directly in python2.x and python3.x code. On python2.x, `...` is only allowed in a "getitem" call (e.g. `foo[...]` or `foo[:, ...]`). Somewhere in the python3.x series (maybe 3.3?), the `...` was promoted to be able to be used anywhere. – mgilson Jan 01 '17 at 21:35
  • @leaf I asked the question because doing a search for `... python` returns close to 0 results. IMO, Synonyms are difficult when the only thing we have are symbols without a name. Which may or may not prompt a user to a search `what are three dots called` to find the name of a thing, to then follow up with another question, `what is an ellipsis in python`, this question is now SEO for linking back to `Ellipsis` if someone searches for `... python` there is a higher chance they will find the answer. – jmunsch Jan 01 '17 at 21:39
  • @jmunsch Did you try typing in [_"three dots python"_](https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=three+dots+in+python)? That brought the exact duplicate linked. Also I searched _"... python"_ but pretty much nothing in relation to Ellipsis was brought up. I don't think google does very good with certian searches. – Christian Dean Jan 01 '17 at 21:54
  • @leaf exactly, bring all the synonyms together. Thanks. – jmunsch Jan 01 '17 at 21:57

0 Answers0