Comment by 1718627440

5 days ago

What you want is for an assignment in a function definition to be a lambda.

  def foo (self, arg=lambda : expression):

Assignment of unevaluated expressions is not a thing yet in Python and would be really surprising. If you really want that, that is what you get with a lambda.

> most languages with closures and default values for arguments do it this way.

Do these also evaluate function definitions at runtime?