optimization question

Andrew Koenig ark at research.att.com
Mon Aug 12 22:22:45 CEST 2002

Terry> If seq is one of the standard, builtin, Python sequence types
Terry> (string, tuple, list), you can count on seq[i:j] being a new,
Terry> separate object.  That is part of the language definition.  In
Terry> the context of comparisons, you can count on it *not* being
Terry> optimized - it is not a possibility.

Surely "not a possibility" is too strong -- if seq[i:j] is an
immutable sequence, the implementation could optimize the
slice if it wanted to do so.

Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark

More information about the Python-list mailing list