On Wed, 06 Jul 2005 10:15:31 -0700, George Sakkis wrote: > Well, they *may* be interchangable under some conditions, and that was > the OP's point you apparently missed.
I didn't miss anything of the sort. That's why I spent 15 minutes actually producing test cases to MEASURE if there was any detectable speed differences between accessing set and frozenset instead of wasting time worrying about "tiny" differences in performance that are almost certainly lost in the noise in real code. If, over a thousand runs of the program, you save a millisecond of time in total, but it costs you two seconds to type the comment in the code explaining why you used frozenset instead of the more natural set, then your "optimization" is counter-productive. Even just considering the question is a waste of valuable developer time! THAT is the lesson of premature optimization: don't even THINK about optimizing code until you have it WORKING and you have MEASURED that it is too slow. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list