File: python_ellipsis.py

package info (click to toggle)
vim 2%3A9.2.0218-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 96,428 kB
  • sloc: ansic: 435,795; cpp: 6,445; makefile: 4,644; sh: 2,569; java: 2,488; xml: 2,099; python: 1,716; perl: 1,419; awk: 730; lisp: 501; cs: 458; objc: 369; sed: 35; csh: 9; haskell: 1
file content (46 lines) | stat: -rw-r--r-- 723 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Ellipsis Literal
# https://docs.python.org/3/library/constants.html#Ellipsis

# Placeholders
...
	...
x = ...
y = ... # Comment
class C: ...
lambda: ...

# Annotations
numbers: Tuple[int, ...]

# Doctests
"""A doctest

>>> class A:
...     def __init__(self):
...		...
>>> class B: ...
>>> x = ...
>>> raise ValueError('multi\n    line\ndetail')
Traceback (most recent call last):
    ...
ValueError: multi
    line
detail
>>> print(list(range(20)))  # doctest: +ELLIPSIS
[0, 1, ..., 18, 19]
>>> exec(s)  #doctest: +ELLIPSIS
-3.21716034272e-0...7
"""

class C:
	"""
	>>> class C:
	...	def __init__(self):
	...		...
	"""

# Numpy
x[..., 0]

# Issue #18263 (Python highlighting ellipsis, false positive)
a = ".." # comment