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

Home » Public Forums » archive » IDL8.4 hard crash
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Hash auto-instantiation (was IDL8.4 hard crash) [message #90316 is a reply to message #90314] Thu, 19 February 2015 10:28 Go to previous messageGo to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Thursday, February 19, 2015 at 8:19:42 AM UTC-7, Fabien wrote:
> On 19.02.2015 15:40, Chris Torrence wrote:
>> But I think in this case, since we're indexing using strings,
>> then we know that we want a hash for the sub-container. I'd hate
>> to complicate it further with a keyword that I have to document.
>
> The argument of the string indexes is true if you have more than one
> nested level.
>
> Just in case you are thinking of a Hash() improvement for a future IDL,
> it would be good not to be limited to default hashes only, as does
> python's defaultdict. The roblem of course is that my example is flawed:
>
> a = hash(DEFAULT=list())
>
> is not okay. I shouldn't give an instance of list but rather a "type"
> list or so:
>
> a = hash(DEFAULT='list')

Actually, in my code I am creating the new container based upon my own class. So if you have an IDL Dictionary it will create a Dictionary for the sub-containers. Similarly for the OrderedHash class.

For example:
d = Dictionary()
d['a','b','c'] = 5
help, d['a']
<Expression> DICTIONARY <ID=6216 NELEMENTS=1>

Speaking of dictionaries, now I'm wondering whether it should work for the "dot" notation as well as the brackets:

d = Dictionary()
d.a.b.c = 5 ; should this auto-instantiate???

I'm thinking that it probably should do the same thing...

-Chris
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: raw contents of data memory
Next Topic: Ring in function graphics

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

Current Time: Wed Oct 08 11:47:40 PDT 2025

Total time taken to generate the page: 0.00414 seconds