Key question

2005-07-05 Thread Klaas-Jan Stol
Hi, currently I'm experimenting a bit with Keys. It seems that a Key *can* be set to a number (floating point), but that this results in a segfault, when using that key. So: .sub main P0 = new .Key P1 = new .Hash P2 = new .Integer # set the key to a number P0 = 1.23 P2 =

Re: Key question

2005-01-07 Thread Leopold Toetsch
Sam Ruby [EMAIL PROTECTED] wrote: See: http://xrl.us/emnk = dynclasses/pydic.pmc Except for fromkeys, get_string, and __new__, the logic is not Python specific, and could easily be refactored into a common base class for others to use. Yep. The problem is that all current usage of hashes

Re: Key question

2005-01-06 Thread Leopold Toetsch
Simon Glover [EMAIL PROTECTED] wrote: Or rather, a question about keys: what should the following two code snippets do? 1) new P0, .Key set P0, 1 set N0, P0 print N0 end 2) new P0, .Key set P0, 1 set I0, P0 print I0 end At the moment,

Re: Key question

2005-01-06 Thread Sam Ruby
Leopold Toetsch wrote: But we should generalize keys eventually. Keys can provide an index for aggregates and allow chaining of indices for nested aggregates. Arrays are simple: the key is an integer. But hashes currently don't support non-string keys easily. We should be able to use arbitrary

Key question

2005-01-05 Thread Simon Glover
Or rather, a question about keys: what should the following two code snippets do? 1) new P0, .Key set P0, 1 set N0, P0 print N0 end 2) new P0, .Key set P0, 1 set I0, P0 print I0 end At the moment, the first one throws an exception ('Key not a