Lambda as a variable, not a Python keyword

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andybevan
    New Member
    • Mar 2011
    • 1

    Lambda as a variable, not a Python keyword

    Apologies in advance for a potentially straightforward question.
    I am recasting several shell scripts (for GRASS GIS functions) in Python (with which I am less familiar), but am running into problems as one input argument for a GRASS module that I wish to call is called 'lambda' which is a Python keyword. Is there something I can invoke to force the parsing of this as an ordinary, non-keyword variable?

    For example, I would like to be able to define lambda=2 in a GRASS function call, but as part of a Python script.

    many thanks

    Andy
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Python reserved words cannot be used as identifiers.

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      Just rename the variable, use a find and replace.

      Comment

      Working...