1

I'm trying to follow the accepted answer for this question. But I can't use x:view(x:nElement()) in Pycharm; apparently, x is an illegal target for variable annotation. I'm unfamiliar with such annotations, so I've tried to understand them from the accepted answer to this question. Doing my best given Pycharm's feedback, I've settled on:

    a, b = x, x
    view: a = a
    nElement: b = b
    return a(b())

Pycharm tells me the local variables view, nElement aren't used. Is this a valid way to do it? Is there a better way?

It wasn't my first attempt, but let me explain the logic behind it. I declared a, b on the first line because if I try

    view: a = x
    nElement: b = x
    return a(b())

then a, b are each considered unresolved references, both on the lines declaring them and on the return line. I placed the nElement brackets on the last line because if I try

    a, b = x, x
    view: a = a
    nElement(): b = b
    return a(b)

I'm told I can't assign a function call.

J.G.
  • 263
  • 2
  • 12

0 Answers0