Skip to content

Commit 2105d9e

Browse files
committed
Do not enforce whitespaces around ** operator; issue #292
1 parent da9f37d commit 2105d9e

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Changes:
2424

2525
* Report E402 for import statements not at the top of the file. (Issue #264)
2626

27+
* Do not enforce whitespaces around ``**`` operator. (Issue #292)
28+
2729
* Strip whitespace from around paths during normalization. (Issue #339 / #343)
2830

2931
* Update ``--format`` documentation. (Issue #198 / Pull Request #310)

pep8.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ def missing_whitespace_around_operator(logical_line, tokens):
688688
if need_space is True or need_space[1]:
689689
# A needed trailing space was not found
690690
yield prev_end, "E225 missing whitespace around operator"
691-
else:
691+
elif prev_text != '**':
692692
code, optype = 'E226', 'arithmetic'
693693
if prev_text == '%':
694694
code, optype = 'E228', 'modulo'

testsuite/E22.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
#:
9090

9191
#: E226
92-
z = 2**30
92+
z = 2//30
9393
#: E226 E226
9494
c = (a+b) * (a-b)
9595
#: E226
@@ -103,8 +103,8 @@
103103
#: E226
104104
c = (a + b)*(a - b)
105105
#: E226
106-
def squares(n):
107-
return (i**2 for i in range(n))
106+
def halves(n):
107+
return (i//2 for i in range(n))
108108
#: E227
109109
_1kB = _1MB>>10
110110
#: E227
@@ -129,7 +129,8 @@ def squares(n):
129129
x = x * 2 - 1
130130
hypot2 = x * x + y * y
131131
c = (a + b) * (a - b)
132-
_1MB = 2 ** 20
132+
_1MiB = 2 ** 20
133+
_1TiB = 2**30
133134
foo(bar, key='word', *args, **kwargs)
134135
baz(**kwargs)
135136
negative = -1
@@ -140,15 +141,14 @@ def squares(n):
140141
if not -5 < x < +5:
141142
print >>sys.stderr, "x is out of range."
142143
print >> sys.stdout, "x is an integer."
143-
z = 2 ** 30
144144
x = x / 2 - 1
145145

146146
if alpha[:-i]:
147147
*a, b = (1, 2, 3)
148148

149149

150150
def squares(n):
151-
return (i ** 2 for i in range(n))
151+
return (i**2 for i in range(n))
152152

153153
ENG_PREFIXES = {
154154
-6: "\u03bc", # Greek letter mu

0 commit comments

Comments
 (0)