On Nov 26, 2007, at 2:29 AM, Peter Otten wrote: > Donn Ingle wrote: > >>> x in range(1,20) ? >> Sure, that's okay, but it has clarity issues, and is calling a func. > > and it requires that x is integral (1.0 is in the range, 1.001 is > not), > and becomes dog slow when the range gets larger. Not a good idea.
That is because range() is not a range in the abstract sense (i.e. simply defining bounds that can be tested for set membership) but are used to create lists (or, in the case of xrange(), successive values) between the bounds given in the params. So, saying x in range(1,20) is not asking if x is between 1 and 20 but, rather, if x is a member of the values genereated by the range function with params 1 and 20. So, yes, using range() Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate & market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman/listinfo/python-list