Random832 <random...@fastmail.com>: > So can we discuss how a unified method to get a set of all valid > subscripts (and/or subscript-value pairs) on an object would be a > useful thing to have without getting bogged down in theoretical > claptrap about the meaning of the mapping contract?
One could compose a table of correspondences: ------------------------------------------- list (L) dict (D) ------------------------------------------- L[key] = value D[key] = value del L[key] (*) del L[key] key >= 0 and key < len(L) key in D range(len(L)) iter(D) L.clear D.clear L.copy D.copy lambda key: L[key] D.get lambda: enumerate(L) D.items lambda: range(len(L)) D.keys ... ... ------------------------------------------- (*) reassigns all keys Marko -- https://mail.python.org/mailman/listinfo/python-list