On Jun 2, 8:36 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> Still nitpicking: using a generator expression in this case has no
> advantage. The first thing that str.join does is to create a list out of
> its argument (unless it is already a list or a tuple). In fact, a list
> comprehension is faster here.

Really!  I stand corrected.

I'm not a C programmer but I peeked at the source.  I see that it
makes a pass to calculate the total size and then another pass to
catenate the items, which makes sense from a memory allocation
standpoint.

To compare and contrast, I looked up the 'sum' built in and saw that
it used the iterator protocol, (PyObject_GetIter).  I assume that the
other similar functions (min,max, etc) would do the same.

Thanks for setting me straight.
...
Jay
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to