merits of Lisp vs Python

Paul Rubin http
Sun Dec 10 03:13:00 EST 2006


"Wolfram Fenske" <int2k at gmx.net> writes:
> In Lisp, I could just write a macro "WITH-CONNECTION" that takes the
> name of the connection variable and the code for "do something with
> the connection" as arguments.  Actually, I ended up writing something
> like it as a function in Python:
> 
>  --8<---------------cut here---------------start------------->8---
>         def withConnection(self, fun):
>             self.lock.acquire() # ...

Do you know about Python's "with" statement?  You'd define a class for
those db connections, that acquire the lock on entry, and release it
on exit.



More information about the Python-list mailing list