In article <[EMAIL PROTECTED]>, Nicola Musatti <[EMAIL PROTECTED]> wrote:
> On Feb 22, 12:07 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > > Nicola Musatti <[EMAIL PROTECTED]> writes: > > > In C++ memory is just another resource which you can handle just like > > > any other one, possibly using RAII. > > > > Ok, I'll bite. Here's a straightforward Python expression: > > > > a = [f(x) + g(y) for x,y in izip(m1, m2) if h(x,y).frob() == 7] > > > > Consider how many intermediate objects are being allocated in figuring > > out that listcomp. Do you REALLY want to manage all the deallocation > > with something like RAII? > > > What makes you think that a translation of a similar expression would > involve explicit dynamic allocation at all? Barring bugs, here's an > equivalent example: > > #include <iostream> > #include <map> > #include <vector> [cut a lot of C++ code] I realize the original point was about dynamic allocation and GC, but for me the raw juxtaposition of the *one* line of clear Python code with the equivalent mass of C++ code is shocking. Thanks for that. -- -- Lou Pecora -- http://mail.python.org/mailman/listinfo/python-list