Python vs. Perl

Thomas Wouters thomas at xs4all.net
Fri May 25 17:48:37 EDT 2001


On Fri, May 25, 2001 at 05:06:19PM -0400, Tim Peters wrote:
> [Thomas Wouters]
> > ... Perl doesn't *have* integers that aren't strings. Perl just has
> > scalars, lists and associative arrays. But the tuples-as-keys is a huge
> > difference with perl hashes -- as far as I recall, that isn't possible.
> > Hash keys have to be scalars. I remember that being one of the
> > top-5 annoyances I had with Perl hashes :)

> You fake it in Perl like so:

>     $hash{$key1, $key2} = $whatever;

> This is syntax magic that catenates the comma-separated sequence of keys
> into a single string, separated by the current value of the $; magic vrbl.

God, yes. That was in the top-2 of my Perl hash annoyances :) The top-1 is,
of course, that you have to go through oddball magic just to see what a hash
contains. I prefer 'print dict' <wink>.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list