3 Oct
2014
3 Oct
'14
7:33 p.m.
On 2014-10-03 11:32 AM, Nick Coghlan wrote:
list(itr) and sum(itr) are both O(n) operations - the time they take is proportional to the length of the input. len(container) by contrast, is an O(1) operation - the time it takes is independent of the length of the input.
What about collections.ChainMap (computes a union)? https://hg.python.org/cpython/file/3.4/Lib/collections/__init__.py#l795 What about mailbox.Maildir (calls os.listdir)? https://hg.python.org/cpython/file/3.4/Lib/mailbox.py#l408 I think there are plenty of virtual containers that fail your rule. -Scott -- Scott Dial scott@scottdial.com