functional programming - python equivalent of quote in lisp -
in python equivalent of quote operator? finding need delay evaluation. example, suppose in following lisp psuedocode have:
a = '(func, 'g) g = (eval a)
what doing deferring evaluation of g
till later time. necessary because want define g
later. equivalent idea of psuedocode in python?
a = lambda: func(g) g = a()
this isn't quite literal translation - literal translation use string , eval
- it's best fit. quoting isn't wanted in lisp anyway; wanted delay
or create lambda
. note func
, g
closure variables in lambda
function, rather symbols, if call a
environment different bindings func
or g
, it'll still use variables a
's environment of definition.
Comments
Post a Comment