Steven D'Aprano wrote:

>> and what exactly does the fact that Python can do operator-based 
>> dispatch much faster than it can do method-based dispatch have to
>> do with sum's inability to add strings ?
> 
> Sorry, I don't get you here. Are you saying that string addition doesn't
> call the operands' __add__ methods?

the "+" instruction (BINARY_ADD) special-cases integers and 8-bit 
strings, and uses a single C call via a type slot for other types.

in contrast, "join" and "sum" needs to do a full name lookup and a
full Python-level function call.  compared to the effort needed to
copy 100 bytes, that's a rather expensive set of operations.

</F>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to