POV-Ray : Newsgroups : povray.off-topic : Innovative open source? : Re: Innovative open source? Server Time
9 Oct 2024 10:15:03 EDT (-0400)
  Re: Innovative open source?  
From: Darren New
Date: 5 Apr 2009 12:22:59
Message: <49d8dae3@news.povray.org>
nemesis wrote:
> Darren New wrote:
>> nemesis wrote:
>>> Darren New <dne### [at] sanrrcom> wrote:
>>>> You're saying "a hastable is for lookups. It doesn't have an order.
>>>> Therefore, Python is right to base its data structures on hash tables."
>>>
>>> It's supposed to be a hashtable.
>>
>> What is "supposed" to be a hashtable?
> 
> Remember we're talking about Python's dict here? 

No. We're comparing PHP's "array" to Python's "dict" and "list."

I said "PHP arrays maintain order." You followed up with "Order shouldn't 
matter in a dictionary." Hence the confusion, because you're talking about 
Python, while I'm comparing Python to PHP.  I'm not sure why you're saying 
anything about "should" if you're talking about "is".

>> If you need a hashtable, PHP's arrays give that to you. If you need a 
>> list, PHP's arrays give that to you. If you need order-preserving 
>> keyed-access data structures, PHP's arrays gives that to you, and 
>> Python doesn't.
> 
> If you need a hashtable, Python's dicts give that to you. If you need a 
>   list, Python's lists give that to you. If you need order-preserving 
> keyed-access data structures, you may derive a new class from Python's 
> dict and implement that custom behavior.

And if several people need order-preserving keyed-access data structures, 
you have a problem knowing which one you want.

> I thought specialization was a good thing, specially performance-wise.

Not when you have the choice of implementing something in C or implementing 
it in Python. Python will almost always lose in that case.

> If you want just an order-preserving list for your items, PHP most 
> likely will still incur in a performance loss by calling a hash function 
> over the item, a Python list won't.

Now you're talking about performance comparisons, when 3 sentences up you 
said you're talking about Python dicts. See my confusion?

> Well, why speculate when we have the sources available?

Why do I need the sources?

> Doing so reveals a lot.  For instance, now it's not simply in the 
> correct specialized behavior, consistent semantics and crystal clear 
> syntax that Python gets my vote as a top-notch language:  comparing it's 
> source with PHP's is also an incredible testament to all the bad things 
> that go into open-source projects you mentioned, except when done right.

I'm not arguing that PHP is better than Python. I said that Python dicts 
aren't as powerful as PHP arrays. Also, Python lists aren't as powerful as 
PHP arrays. I have no idea how you go from there to "Python's source code is 
better commented than PHP's source code."

> It's amazing you can nitpick and even pick a fight for tools you most 
> likely don't even care, Darren...

I'm just trying to understand your point, having a conversation. If at the 
start you'd said "A dict or a list is going to be more efficient than a 
combination of the two", I wouldn't have argued in the least. But that isn't 
what you said, implying that there was something about the topic you could 
teach me. Like there was some deeper, more subtle thing wrong with combining 
the two than "it's less efficient if you don't use all the features."

-- 
   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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.