Thoughts about Python

David M. Cooke cookedm+news at physics.mcmaster.ca
Tue Feb 24 17:52:10 EST 2004


At some point, PPNTWIMBXFFC at spammotel.com (Marco Aschwanden) wrote:

>> Forget the speed and memory difference. The main argument for tuples as a 
>> separate type are to use as dictionary keys. How do you propose to handle 
>> dictionary keys without tuples?
>
> Maybe I don't get the point here: Why do dictionaries need tuples to
> work? I know that tuples can be used as keys... but how many times do
> you need tuples as dictionary keys (it would be simple to turn a list
> into an immutable string if really needed ("::".join(["a","b"]).

Simple, yes. Practicable, no. Wrong, certainly. For instance, I have a
lot of use cases where I use tuples of numbers -- (3, 4, 20.0101), eg.
It'd be a *hack* to convert that into a string, and the representation
would not be unique. This ain't Perl.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list