|
|
nemesis wrote:
>> I said "PHP arrays maintain order."
>
> No, you said "A /dictionary/ in PHP is more like an array of key/value
> pairs." if I may nitpick. Then I replied a dictionary is a hash table
> and order is not important in a hash table.
A dictionary isn't a hashtable, tho. A hashtable is a hashtable.
I dare you to look up a word in Webster's dictionary if it's not in order.
> I was not talking about Python when saying order shouldn't matter in a
> dictionary. You look things up in a dictionary, individually.
"Hashtable" has a language-neutral definition. "Dictionary" does not, nor
does "map". You might want to look at (say)
http://en.wikipedia.org/wiki/Dictionary_(data_structure)
before you try arguing.
>> Not when you have the choice of implementing something in C or
>> implementing it in Python. Python will almost always lose in that case.
>
> What is Python losing here with its specialized data structures,
> implemented in C?
Then you're not implementing your specialized data structure in Python, are
you? If you want an ordered dictionary in Python, you can implement it in
Python, or in C. The implementation in Python will almost always be slower
than the implementation in C when you do that. It's losing efficiency, to
precisely answer your question.
However, ordered dictionaries in PHP (called "array" by the language) is
already in the language and implemented in C, do you don't need to try to
implement it in PHP, assuming the order you want is what PHP provides.
> Why confusion when you understand perfectly well I'm now talking about
> performance and its relation to specialized data structures, and thus,
> dicts?
You keep bopping between "hashtable" and "dict" and "dictionary", which are
three different concepts.
>>> Well, why speculate when we have the sources available?
>>
>> Why do I need the sources?
>
> To see I'm not lying?
About... PHP arrays being slower than Python dicts? Perhaps you haven't yet
gotten to my post where I gave the timings.
>> I said that Python dicts aren't as powerful as PHP arrays. Also,
>> Python lists aren't as powerful as PHP arrays.
>
> But they are, for their respective jobs.
This makes no sense to me. If you're comparing the capabilities of different
data structures, you don't exclude everything that one can do that the other
can't in your comparison. That's like saying a bicycle goes just as fast as
an automobile, as long as you don't leave the driveway.
> Oh, you would, sir.
You're dreaming.
> It's a question of principles: specialization is good and a dict is a
> hash table, an unordered set.
I disagree that specialization is necessarily good. You're taking it as an
axiom without any support. I'm just trying to figure out if you had some
support, or whether you were arguing that everyone should accept your axiom
unquestioned.
I *thought* it was beginning to sound like a religious argument.
--
Darren New, San Diego CA, USA (PST)
There's no CD like OCD, there's no CD I knoooow!
Post a reply to this message
|
|