[Python-3000] Making more effective use of slice objects in Py3k
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Sat Sep 2 09:57:11 CEST 2006
Greg Ewing <greg.ewing at canterbury.ac.nz> writes:
> It might be possible to represent it in a narrower format,
> however. Perhaps there should be an explicit operation for
> re-packing a string into the narrowest possible format?
I suppose it's better to always normalize a polymorphic string
representation. And always normalize bignums to fixnums (long->int).
It increases chances of using the more compact representation.
It doesn't add any asymptotic cost, it's done when the whole
object is to be allocated anyway (these are immutable objects).
It simplifies equality comparison.
The narrow formats should be statistically more common than wide
Programmers should not be expected to care about explicitly calling
a normalization function.
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
More information about the Python-3000