merits of Lisp vs Python

Wolfram Fenske int2k at gmx.net
Sun Dec 10 04:04:16 EST 2006


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:

> "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.

Yes, I wrote about it in another post.  It was introduced in Python
2.5. And if it hadn't been I'd still have to write code like this.

--
Wolfram Fenske

A: Yes.
>Q: Are you sure?
>>A: Because it reverses the logical flow of conversation.
>>>Q: Why is top posting frowned upon?




More information about the Python-list mailing list