Dictionary from list?

Erik Max Francis max at alcyone.com
Fri Oct 19 14:03:52 EDT 2001


Andrei Kulakov wrote:

> You know, this sort of thing comes up often - X is a built-in feature
> in
> perl, why do I have to do it manually in python? I think this is a
> justified design decision - there's simply too many built-in things
> perl
> does. You can't remember all of them and if you look at someone else's
> perl program you have to scratch your head a lot. Python is small,
> lean
> and clean, and that's one of the best things about it.

In particular, what this is really revealing is that a Perl associative
array is really represented as a list, with each successive pair
representing a key and a value.  (When writing list and associative
array literals, you see the same thing.)

This goes back to Perl's weakly-typed approach to everything.  Since
Python is not weakly typed, emulating this behavior is not only not
convenient, but is not even advisable.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ When one is in love, a cliff becomes a meadow.
\__/ (an Ethiopian saying)
    7 sisters productions / http://www.7sisters.com/
 Web design for the future.



More information about the Python-list mailing list