On Thu, 23 Apr 2009 17:18:25 +0800, Leo wrote: >> There's also the performance issue. I might have a sequence-like >> structure where calling len() takes O(N**2) time, (say, a graph) but >> calling __nozero__ might be O(1). Why defeat the class designer's >> optimizations? > > Is that true? > Calling len() actually traverses the whole list?
Not for built-in lists, but for sequences created by somebody else, who knows what it does? -- Steven -- http://mail.python.org/mailman/listinfo/python-list