www-community mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rich Bowen <rbo...@rcbowen.com>
Subject Re: python foo (was: email notification done...sorta)
Date Thu, 09 Jan 2003 22:39:42 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 9 Jan 2003, Greg Stein wrote:

> >>> array = [ [1, 2, 3],
> ...           [4, 5, 6],
> ...           [7, 8, 9] ]
> >>> print array[1][2]
> 6
> >>> sparse = { (1,2): 6, (2,1): 8 }
> >>> sparse[1,2]
> 6
> >>>
>
> (and don't ask me about the time I tried to do a hash of hashes of hashes in
>  Perl... even with Perl hacker help, I gave up; Perl just wouldn't do it)

Oh, come on. I do hashes of hashes of hashes frequently in Perl. And
hashes of hashes of arrays of hashes of arrays. And ... well, other
permutations.

And the syntax for a multi-dimensional array is almost
indistinguishable from the example you gave in Python.

$matrix = [
           [1, 2, 3],
           [4, 5, 6],
           [7, 8, 9] ];
print $matrix->[1][2];

A little more punctuation, but, then, you'd expect that from Perl.

You must have a very lame Perl hacker at your disposal. ;-)

- -- 
Oh I have slipped the surly bonds of earth
And danced the sky on laughter-silvered wings
 --High Flight (John Gillespie Magee)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6

iD8DBQE+Hfo0XP03+sx4yJMRAsL8AJ49DT5Hxwftqja8L3w6VW12J5UTbwCg04m5
YOCMTjXkAMpPfIR5WYS29Ac=
=IeC3
-----END PGP SIGNATURE-----



Mime
View raw message