Why are there no ordered dictionaries?
Christoph Zwerschke
cito at online.de
Fri Nov 25 16:50:53 EST 2005
Tom Anderson wrote:
> True, but that's not exactly rocket science. I think the rules governing
> when your [] acts like a dict [] and when it acts like a list [] are
> vastly more complex than the name of one attribute.
I think it's not really rocket science either to assume that an ordered
dictionary behaves like a dictionary if you access items by subscription
and like a list if you use slices (since slice indexes must evaluate to
integers anyway, they can only be used as indexes, not as keys).
>> Python's strength is that you don't have to keep many details in mind
>> because it has a small "basic vocabulary" and orthogonal use.
> No it isn't - it's in having a wide set of basic building blocks which
> do one simple thing well, and thus which are easy to use, but which can
> be composed to do more complex things. What are other examples of this
> kind of 'orthogonal use'?
I mean for instance that you can deal with a tuple in the same way as
with a string and things like that. Concerning "small": Somebody coined
the good slogan "Python fits my brain" but I could also say "Python fits
*into* my brain" (I mean without the batteries of course ;-) - you
pretty soon have all the built-in functins, datatypes and their use in
your head. On the other side of course, Python is a huge field and you
can discuss endlessly as we are doing here.
Anyway, my argument was not good (avoiding new attributes names in order
to keep the vocabulary small).
And by the way, what both of us listed as strengths of Python will be
probably claimed by protagonists of any other language as well.
-- Christoph
More information about the Python-list
mailing list