0

I have a for-loop with with a tuple decomposition expression. maybe it's known as tuple unpacking.

Example code:

for funcname,func in self.GetMethods:
  # do somthing with func
  # funcname is unused

My code checking tool (I'm testing Landscape.io) complains about funcname as a unused variable.

How can I satisfy Landscape.io and maybe other checkers?

I saw loop like this:

for _,func in self.Getmethods:
  # loop body

Is _ a:

  • useless, but short identifier or
  • some kind of wildcard?
Paebbels
  • 15,573
  • 13
  • 70
  • 139

0 Answers0