NEWBIE: Extending a For Statement.

mosscliffe mcl.office at googlemail.com
Mon May 21 10:21:18 EDT 2007


On 21 May, 15:02, bearophileH... at lycos.com wrote:
> mosscliffe:
>
> > if key in xrange (60,69) or key == 3:
>
> I keep seeing again and again code like this, mostly from people not
> much expert of Python, but the PEP 260 shows the fast in was removed,
> so it's O(n). Maybe removing the fast __contains__ was bad for
> necomers (or just the casual Python users, that I belive is really
> large).
>
> Bye,
> bearophile

Being a non-expert in python in fact just a beginner / casual user,
can you expand on how 0(n) relates to
    if key in xrange (60,69) or key == 3:

My mind tends to go blank at the mention of __xxx__.

R







More information about the Python-list mailing list