When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?
Steven D'Aprano
steve at REMOVE.THIS.cybersource.com.au
Fri Apr 20 22:18:34 EDT 2007
On Fri, 20 Apr 2007 15:36:00 -0700, seberino at spawar.navy.mil wrote:
>
>
>> The article explains that, amongst other things, tuples are faster
>> than lists, so if you are working with constant values (inmutables)
>> they are more indicated than lists.
>
> Thanks. I thought Python's design wasn't so concerned with
> optimizations.
> Adding a new type "just" for optimization reasons seems perhaps
> unnecessary. I could be wrong.
It's times like this I want to cry...
>>> adict = {(1,2): "parrot"}
Try replacing that tuple with a list. "Just optimization" my eye!
--
Steven.
More information about the Python-list
mailing list