File: comprehensions.py

package info (click to toggle)
python-jedi 0.10.0~git1%2Bf05c071-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,064 kB
  • ctags: 3,014
  • sloc: python: 16,997; makefile: 149; ansic: 13
file content (41 lines) | stat: -rw-r--r-- 756 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
[a + 1 for a in [1, 2]]

#! 3 type-error-operation
[a + '' for a in [1, 2]]
#! 3 type-error-operation
(a + '' for a in [1, 2])

#! 12 type-error-not-iterable
[a for a in 1]

tuple(str(a) for a in [1])

#! 8 type-error-operation
tuple(a + 3 for a in [''])

# ----------
# Some variables within are not defined
# ----------

#! 12 name-error
[1 for a in NOT_DEFINFED for b in a if 1]

#! 25 name-error
[1 for a in [1] for b in NOT_DEFINED if 1]

#! 12 name-error
[1 for a in NOT_DEFINFED for b in [1] if 1]

#! 19 name-error
(1 for a in [1] if NOT_DEFINED)

# ----------
# unbalanced sides.
# ----------

# ok
(1 for a, b in [(1, 2)])
#! 13 value-error-too-few-values
(1 for a, b, c in [(1, 2)])
#! 10 value-error-too-many-values
(1 for a, b in [(1, 2, 3)])