comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: HASH question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: HASH question [message #75458 is a reply to message #75360] Mon, 07 March 2011 09:55 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Jeremy Bailin wrote:
>
> Really? That seems like a horrible design to me. It's fine if you're dealing with one element, but what if you want
> to change the type of many of them at once? Then there's no way to do it without a for loop?

Yes. But, I would argue that if you wanted to do that regularly, the hash of structures like I described is probably not
the best choice.

An additional "but": If the hash keys to access the data is a vector (e.g. representing the "many of them") so would
bethe new values (you can't assume that the new values would all be the same, right?). Assuming it was possible, do you
think doing something like,

hashtable[ids_to_change].type = array_of_new_values

is o.k.? I don't (but remember, I'm a physicist who writes code so what the hell would I know? :o) That would make it
way to easy to assign the wrong value. What if the two vectors, "ids_to_change" and "array_of_new_values", were
different sizes? Of what if some of the keys in the "ids_to_change" vector didn't yet exist in the hash?


cheers,

paulv
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Another triangulate/griddata question
Next Topic: overplotting contours on a map

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 02:26:52 PDT 2025

Total time taken to generate the page: 0.80142 seconds