Skip to content

TP0218

Error: keyword argument not accepted

  • '<p>' is positional-only, so it can't be passed by keyword (M30)
  • '<f>' takes no keyword arguments (a built-in)
  • a function value takes no keyword arguments
  • '<f>' has no parameter '<k>' (M14; also for sorted, sort and enumerate)

From the golden case tests/cases/m3/tp0218_keywords.tpn:

tp0218_keywords.tpn
def add(a: int, b: int) -> int:
return a + b
add(a=1, b=2, c=3)
print("x", color="red")
for i in range(stop=3):
pass

The compiler reports:

tp0218_keywords.tpn:4:15: error TP0218: 'add' has no parameter 'c'
tp0218_keywords.tpn:5:12: error TP0218: 'print' has no parameter 'color'
tp0218_keywords.tpn:6:16: error TP0218: 'range' takes no keyword arguments

The specification lists every code.