Left: | ||
Right: |
OLD | NEW |
---|---|
1 def compare_int_like_yoda(x): | 1 def compare_int_like_yoda(x): |
2 # * A103 | 2 # * A103 |
3 return 1 == x | 3 return 1 == x |
4 | 4 |
5 | 5 |
6 def compare_string_like_yoda(x): | 6 def compare_string_like_yoda(x): |
7 # * A103 | 7 # * A103 |
8 return 'foo' == x | 8 return 'foo' == x |
9 | 9 |
10 | 10 |
11 def compare_none_like_yoda(x): | 11 def compare_none_like_yoda(x): |
12 # * A103 | 12 # * A103 |
13 return None is x | 13 return None is x |
14 | 14 |
15 | 15 |
16 def compare_tuple_like_yoda(x): | 16 def compare_tuple_like_yoda(x): |
17 # * A103 | 17 # * A103 |
18 return (1, 'foo') == x | 18 return (1, 'foo') == x |
19 | 19 |
20 | 20 |
21 def compare_literals(): | 21 def compare_literals(): |
22 return (1, 'foo') == (2, 'bar') | 22 return (1, 'foo') == (2, 'bar') |
23 | 23 |
24 | 24 |
25 def compare_variables(a, b, c, d): | 25 def compare_variables(a, b, c, d): |
26 return (a, b) == (c, d) or a == b | 26 return (a, b) == (c, d) or a == b |
27 | |
28 | |
29 def compare_builtin(x): | |
30 return dir == x | |
Sebastian Noack
2017/10/05 22:07:11
This was causing an A103 (yoda expression), since
Vasily Kuznetsov
2017/10/06 10:46:21
Isn't this kind of a genuine yoda expression thoug
Sebastian Noack
2017/10/06 18:11:09
Another way to look at it is that builtin function
| |
OLD | NEW |