The following function declaration incorrectly gives a C0322 ("Operator not
preceded by a space") error.

@f(a=2,
   b=3)
def g1(x):
    print x

The following three elements need to all be present in order to generate
this error:

-- using a function call expression as a function decorator
-- the expression must be split over multiple lines
-- the function is called using a keyword argument

A more full example is below.

James.

--

$ cat /tmp/test.py
def f(a, b):
    print a, b

# Generates C0322.
@f(a=2,
   b=3)
def g1(x):
    print x

# The following are all fine.
@f(a=2,
   b=3)
def g2():
    pass

@f(a=2, b=3)
def g3(x):
    print x

f(a=2,
  b=3)

$ pylint /tmp/test.py
************* Module test
C0322:  6:g1: Operator not preceded by a space
   b=3)
    ^
def g1(x):
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to