[Python-Dev] Retrieve an arbitrary element from asetwithoutremoving it
"Martin v. Löwis"
martin at v.loewis.de
Mon Nov 9 22:50:11 CET 2009
> So the rationale is to ensure that only add operations perform a resize
> and so that sequential pop() operations don't incur excessive resizing
> costs.
I agree that the use case of repeated .pop() operations is reasonable,
and (IIUC) that case is also special-cased using a finger/index.
I think for regular removal, the same logic should not apply: if a
series of removals is performed, then further (non-pop) removals
see increasing costs, as do regular lookups. So I think that a removal
should trigger shrinking (with appropriate thresholds) unless it's a
.pop.
Regards,
Martin
More information about the Python-Dev
mailing list