K
kettle
Hi,
I'm wondering what the best practice is for creating an extensible
dictionary-of-dictionaries in python?
In perl I would just do something like:
my %hash_of_hashes;
for(my $i=0;$i<10;$i++){
for(my $j=0;$j<10;$j++){
${$hash_of_hashes{$i}}{$j} = int(rand(10));
}
}
but it seems to be more hassle to replicate this in python. I've
found a couple of references around the web but they seem cumbersome.
I'd like something compact.
-joe
I'm wondering what the best practice is for creating an extensible
dictionary-of-dictionaries in python?
In perl I would just do something like:
my %hash_of_hashes;
for(my $i=0;$i<10;$i++){
for(my $j=0;$j<10;$j++){
${$hash_of_hashes{$i}}{$j} = int(rand(10));
}
}
but it seems to be more hassle to replicate this in python. I've
found a couple of references around the web but they seem cumbersome.
I'd like something compact.
-joe