[Israel.pm] Python talk

Mikhael Goikhman migo at homemail.com
Tue Dec 7 09:34:59 PST 2004


On 07 Dec 2004 16:55:24 +0200, Gaal Yahas wrote:
> 
> Mikhael wrote:
> 
> > And if the keys are constant arrays and not variable arrays, then you
> > don't even need to join the array elements to construct the key (but
> > you should be aware that Perl converts arrayref to string here):
> >
> >    $time = [ 100, 200 ];
> >    $CAA->{$time} = { label => 'somewhere', population => 12, time => $time };
> 
> I forgot to mention that this approach, apart from potentially being
> dangerous due to the ref-reuse prolem, has the obvious limitation that
> applicatively equivalent keys will not match elements. I *must* have
> $time to restore the value. I will be disappointed if I do
> 
>     $time2 = [ 100, 200 ];
> 	return $CAA->{$time2}; #undef
> 
> What I typically want for object keys is that they associate to the same
> element if they pass (in Javaesque parlance) an isEqual test.

It seems you completely missed my note that this limited technique only
works "if the keys are constant arrays and not variable arrays". :)

I actually used this. Some external module had distinct array constants
defined and I used them as hash keys.

Regards,
Mikhael.

-- 
perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'



More information about the Perl mailing list