Terry Reedy schrieb:
> On the consistency argument: sorted(somelist) calls copy(somelist).sort, 
> not copy(somelist).__sort__.  

Actually, it calls list(somelist).sort, so it requires iteration, not 
copying, and the result will be known to be a list. So the important
difference is that .sort is not a method that the argument to sorted
needs to implement (indeed, it has no option to define its own sorting
algorithm). This is different from __next__, which user-defined types
will need to implement.

> One of the virtues, and as I recall, design purposes, of .next calls is to 
> be fast. 

I think this holds for the C level only. Python-level invocations will 
create a method-wrapper (or bound method) every time, so that won't
be fast.

Regards,
Martin
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to