[Israel.pm] Python talk

Gaal Yahas gaal at forum2.org
Tue Dec 7 10:02:22 PST 2004

On Tue, Dec 07, 2004 at 07:06:08PM +0200, Omer Zak wrote:
> The gist of discussion is that Python is, after all, better than Perl x.y
> (for x.y<6.0) when one wishes to use complicated data structures as keys
> of associative arrays.

I'm not sure there's been a conclusion yet. We need more input from
people who are proficient in both languages. (I hope you don't take
offence if I say that a proficient Perl programmer needs to grok perlref.)

> So this is not just the way my own neurons are wired together.
> Makes me feel like the boy. who threw a stench bomb into the room and ran
> away for cover as agitation ensued.

Why do you find it difficult to have have a civil discussion about languages?

> Besides complicated data structures, there are also other benchmarks for
> comparing Python to Perl, but I'll defer to the Python talk for the
> discussion about them.
> I don't know how I'd feel about programming in Perl vs. Python if it were
> not for the question of representing complicated data structures.

Are you familiar with Perl's tie interface? So far I don't think
anything's come up in this discussion that tied hashes can't account
for. It takes some work, of course, but then, it's been done for you by
the CPAN modules. (Then again, I haven't made heavy use of the complex-key
modules myself, so I can't really give a fair critique.)

You could insist that Python is better because you don't have to pull in
any magic to get objects for keys, but I suppose the counter argument is
that for *most* applications of hashes, string keys are sufficient and
it's a pity to pay the speed penalty everywhere for the sake of purism.

Sure, this violates the principle of least surprise, but it only has to
surprise you once, and the rememdy is (to my mind, at least) acceptable.

Gaal Yahas <gaal at forum2.org>

More information about the Perl mailing list