[Python-checkins] CVS: python/dist/src/Doc/lib libcrypt.tex,1.14,1.14.4.1

Fred L. Drake, Jr. fdrake@acm.org
Tue, 15 Feb 2000 12:42:21 -0500 (EST)


Greg Stein writes:
 > Actually, it is arguable which is faster. Using the "in" form means that
 > you construct the tuple at runtime, then perform the "in" check. The
 > version using "or" is simply a couple comparisons.

  Actually, I think the tuple is compiled to an entry in the constants 
table when the contents are also constants (Jeremy, you're playing
with this nowadays; any insight?).

 > In other words, it really comes down to which form is most readable. I
 > think Peter's original form using "or" is more readable. Fredrik's is
 > easier to extend to include more alternatives. Your call :-)

  The two == tests are faster, at least when comparing a local var to
a local var or a constant.


  -Fred

--
Fred L. Drake, Jr.	  <fdrake at acm.org>
Corporation for National Research Initiatives