[Python-3000] Dict literal bytecode

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 27 00:48:01 CET 2008


Alexander Belopolsky wrote:

> 1. Do nothing: dicts are built incrementally, and sets in batch.
> 2. Implement batch processing for dict literals.
> 3. Implement incremental processing for sets.

My thought is that sets are the odd one out here.

Tuples are created batchwise because, being immutable,
that's the only way to do it. But if set literals are
to produce mutable objects, there's no need for them
to be created batchwise, and doing so has unfortunate
stack size and memory use consequences in the worst case.

Keep in mind that large set constructions are likely
to be done at the module level, and if the module
then goes on to call the main function of a program,
that big stack frame is going to stay around for
the life of the process.

-- 
Greg


More information about the Python-3000 mailing list