|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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? A Python dict is
supposed to be Python's builtin hashtable feature. They also employ it
behind the scenes to hold objects' attributes.
> 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.
I thought specialization was a good thing, specially performance-wise.
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.
Well, why speculate when we have the sources available?
Here's how to get the PHP ones:
http://br2.php.net/get/php-5.2.9.tar.bz2/from/a/mirror
And here's how to get the Python one:
http://python.org/ftp/python/2.6.1/Python-2.6.1.tgz
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.
PHP's source is a hell of a mess and tracking down the exact location of
array definition was not easy at all and I had to look up quite a few .h
and greap a bit to find out the one directory it was in:
php5/ext/standard/array.c
Looking inside is like looking into the Devil's guts. Few comments,
lots of macros defined elsewhere, no clue on how to decypher it.
Python's one is a breeze to find:
Objects/dictobject.c
very logical and just as beautiful to look at as Python code.
Both are in C.
And yes, PHP does incur into the hash cost at all times, even if you
just intend to use arrays as a simple list. See
"php5/ext/standard/array.c", array_push, zend_hash_next_index_insert.
Python's lists don't have such problem, as any specialized data structure.
It's amazing you can nitpick and even pick a fight for tools you most
likely don't even care, Darren...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
nemesis wrote:
> It's amazing you can nitpick and even pick a fight for tools you most
> likely don't even care, Darren...
BTW, what tools do you think I'm fighting over? You need to go back and
reread the thread.
I say "PHP arrays have a feature that Python dicts don't." (More precisely,
in spite of triple_r saying "And dictionaries? Outstanding.", that Python
dictionaries are no different from bog-standard hashtables, unlike in some
other languages.)
You are the one that turned it into "Python rulez! PHP Suxors! PHP is
*wrong* and Python is *right*, and if you can't see that then a thousand
years of mathematicians prove you're stupid!"
I wasn't turning it into a fight at all. I was just being polite and
pretending you actually had a reason for turning it into a discussion rather
than a cheerleading fest, including reading source code of each interpreter
and commenting on the genetic lineage of the authors thereof.
Had you just said "The rest of Python rocks", or "unnecessary features
universally applied can be inefficient", I would have agreed. But you said
"this data structure is incorrect", implying there was something outside the
API of the data structure that would be relevant to other data structures.
I like Python. It's my new favorite language, or will be once I get good at
it. PHP is the suckiest language I've ever been forced to use, with
essentially no redeeming qualities. (Worse even than C++ which *does* have
many redeeming qualities. :-)
So don't give me this "you started a fight" crap just because I was polite
and gave you the benefit of the doubt that you weren't trying to.
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Darren New wrote:
> 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."
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.
> 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 was not talking about Python when saying order shouldn't matter in a
dictionary. You look things up in a dictionary, individually.
>> 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.
What is Python losing here with its specialized data structures,
implemented in C?
>> 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?
Why confusion when you understand perfectly well I'm now talking about
performance and its relation to specialized data structures, and thus,
dicts?
>> Well, why speculate when we have the sources available?
>
> Why do I need the sources?
To see I'm not lying?
> 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.
>> 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.
Oh, you would, sir.
> 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."
It's a question of principles: specialization is good and a dict is a
hash table, an unordered set.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Darren New wrote:
> So don't give me this "you started a fight" crap just because I was
> polite and gave you the benefit of the doubt that you weren't trying to.
Well, sorry. You politeness always sounds like trolling over nitpicks.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
nemesis wrote:
> Darren New wrote:
>> So don't give me this "you started a fight" crap just because I was
>> polite and gave you the benefit of the doubt that you weren't trying to.
>
> Well, sorry. You politeness always sounds like trolling over nitpicks.
Somehow, asking people to support their assertions of facts always seems to
sound like trolling. I wonder why that is.
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Darren New wrote:
> Somehow, asking people to support their assertions of facts always seems
> to sound like trolling.
Do you have a reference to back that up? ;)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Kevin Wampler wrote:
> Darren New wrote:
>> Somehow, asking people to support their assertions of facts always
>> seems to sound like trolling.
>
> Do you have a reference to back that up? ;)
Opinions are their own references. I don't argue with opinions, either.
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Fri, 03 Apr 2009 21:26:35 -0300, nemesis wrote:
> Jim Henderson wrote:
>> On Fri, 03 Apr 2009 18:08:30 -0300, nemesis wrote:
>>
>>> When the company
>>> was closing doors, they realized the tool was quite complete and good
>>> enough perhaps not for going commercial
>>
>> I understood that it used to be commercially available....
>
> Not quite sure about that. But the company was definitely closing doors
> and seemingly not interested in maintaining it though they saw its
> value.
http://www.blender.org/blenderorg/blender-foundation/history/
It was released commercially by a company called "Not a Number" (or NaN),
but was originally developed in-house by a Dutch animation studio. NaN
failed and sold Blender the community.
Jim
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|