Hi All-- Cameron Laird wrote: > . > I have a few comments on this: Python can do essentially what > PHP does. One means is the getattr() Reinhold cites. > > HOWEVER, it's generally always a mistake to do so. Dictionaries > are simply better. AND THAT'S TRUE IN PHP, too. I'm frankly > disappointed in PHP leaders that they continue to promote this > "variable-variable" idiom. As much as anything is certain in > the realm of stylistic expression, dictionaries are a superior > mechanism. >
I don't know if this dictionary insight is Cameron's, but my experience with Python has been that when I'm developing something from scratch, I'll start with a big pile of cruft. "I think I'll need this. Oh, and that, too. And what about this! Oooh, cool!" Then I start carving away the excess. It usually takes two or three iterations at carving to realize that whatever it is needs a dictionary. I have never seen a case where a dictionary didn't improve the design. +1QOTW. Well. Storing a Mayan number/date as a dictionary turned out to be a Spectacularly Bad Idea(tm);-), so I guess that's one case. Metta, Ivan ---------------------------------------------- Ivan Van Laningham God N Locomotive Works http://www.andi-holmes.com/ http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours -- http://mail.python.org/mailman/listinfo/python-list