Fredrik Lundh wrote: > James Stroud wrote: > > > without requiring an iterator > > can we perhaps invent some more arbitrary constraints while we're at it? > > </F> >
I guess while I'm at it, this thread wouldn't have so much steam were these idioms seemingly unpythonic: "".join(reverse(x)) alist[::-1] The latter, while more terse than alist.reversed(), is unnatural and ugly compared to the general elegance of other constructs in python. Were this not the case, beginners and intermediate programmers alike would not have such trouble remembering it. In fact, the latter's exact behavior, if I remember correctly, spawned a thread of its own with much speculation as to the exact meaning of the documentation and whether the API conformed to this inferred meaning. I'll attempt to provide a link to the thread if anyone takes me to task on this. I'm sure many life-long programmers will claim that they have never created a reverse copy of a data structure for production code, but why is it that so many jump to the fore to point out that alist[::-1] is how one produces a reverse copy of a list, or that a string can be reversed with reversed, join, and an instance of another string (did I leave something out?)? But why do so many beginning programmers ask how one might produce a reverse data structure in python? Perhaps they are just ignorant fools who don't know that creating a reverse copy of a data structure can be proven to be a useless operation if only they would stop trying to write code and begin to write formal proofs. Perhaps their professors are to blame, unreasonably asking them to write actual code before memorizing all three+ volumes of Knuth. I'm sure the proof is in there somewhere. But maybe it is not the purpose of a poweful language like python to be used as a teaching language. Maybe python should be reserved for use only by those who have been desensitized to its idiosyncracies, inconsistencies, and idiomatic workarounds. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list