-1

The python 3.4.1 Functional Programming documentation provides examples of itertools. It is section 10.1 under the Functional Programming section 10.0. There is a lambda function defined with the syntax: (The value of r is set elsewhere in the example.)

lambda(x,_:r*x*(1-x))

I have not seen the _ syntax as above. Can someone explain the _ please. In Erlang the _ would match a "don't care". I don't know what it does here.

Thank you.

user2357112
  • 260,549
  • 28
  • 431
  • 505

1 Answers1

1

_ is a variable like any other. The name _ is typically used for variables we don't care about, though this is just a convention; the value isn't automatically discarded or anything.

user2357112
  • 260,549
  • 28
  • 431
  • 505