At 01:38 PM 2/16/2007 +0100, Martin v. Löwis wrote: >Nick Coghlan schrieb: > > However, another aspect that occurred to me is that inheriting from > > tuple has significant practical benefits in terms of speed and memory > > consumption, at which point it doesn't seem worthwhile to *remove* the > > indexing capability. > >I'm not so sure that inheriting from tuple, and giving it named fields, >has significant speed and memory benefits. In particular for the memory >benefits, you can use __slots__ to achieve the same effects, and more >efficiently so (because it you don't store the tuple length). As for >speed, I would have to see measurements to be convinced it is faster.
For an otherwise-pure Python implementation, the performance benefit of inheriting from a tuple is in having ready-made C implementations of hashing and comparison. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com