Python vs. Perl
Gisle Aas
gisle at ActiveState.com
Fri May 25 23:57:32 EDT 2001
"Alex Martelli" <aleaxit at yahoo.com> writes:
> > Perl: %hash = (a=>{a=>'b', b=>'c', c=>'a'}, b=>{...etc...}); This is
> pretty
> ...
> > Python excels at dictionaries. Frankly, I find python's syntax a bit
> > burdensome and wordy.
>
> hash = {a:{a:'b', b:'c', c:'a'}, b:{et:c}}
>
> How is this "burdensome and wordy" compared to the Perl syntax
> you just quoted so admiringly...?!
You would actually have to write {'a':{'a': ... in Python
to have the same effect as the Perl code above. That clearly
makes the perl key syntax more concise.
a=>
vs 'a':
but then unfortunately Perl looses big time when you don't want
use variables as keys:
$a=>
vs a:
--
Gisle Aas
More information about the Python-list
mailing list