What can you do in LISP that you can't do in Python

Terry Reedy reedy37 at home.com
Wed May 23 01:27:18 EDT 2001


"Darren New" <dnew at san.rr.com> wrote in message
news:3B0B4022.4B7A5AD2 at san.rr.com...

> Err, so if it's inside a loop, you're running the "def" each time thru
> the loop? Or does Python take care of that for you, and only run the def
> statement once?

def is a statement like any other, and it is executed each time it is
encountered.  However, the statements forming the body of the def are
reportedly only compiled once - when first read -- into a code object.  On
each execution, a new function object is created pointing to the constant
code object, so the each-time overhead is not as bad as one might imagine.





More information about the Python-list mailing list