POV-Ray : Newsgroups : povray.off-topic : Innovative open source? : Re: Innovative open source? Server Time
6 Sep 2024 07:17:22 EDT (-0400)
  Re: Innovative open source?  
From: Kevin Wampler
Date: 4 Apr 2009 02:34:30
Message: <49d6ff76$1@news.povray.org>
Darren New wrote:
> IIRC, if you use integer keys, you get what you'd expect.

I'm actually not sure what to expect here.  For instance:

D = dict()
D[1] = "foo"
try:
	if D[0] == D[1]:
		print "maybe this makes sense?"
	else:
		print "ok, this is odd"
except:
	print "maybe this also makes sense?"


I think the issue is that this sort of structure has two types of 
indices, and when both are ints there's no way to properly distinguish 
them, so I can't think of what behavior would be appropriate.

On the other hand, it's probably not a very big issue in practice, since 
at worst the behavior (whatever it is) would be just another one of 
those language quirks that you have to memorize, and there's certainly 
no shortage of those in most languages.

> Note that you can iterate over a list without giving specific indexes, 

This is a different matter, and I don't think it has any of the problems 
  that using integers as direct indices does.  I might imagine that such 
a structure tightly integrated into a language might have uses which 
outweighed it's somewhat higher inefficiency, although I can't think of 
just what those uses might be.  As a matter of taste, however, I tend to 
prefer have the basic structures at my disposal be closely related to 
basic classes of algorithms and to build more complicated assemblages as 
I need from those parts.  Hence my preference for hashtable or 
ordered-tree backed dicts types.


Post a reply to this message

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