[Python-Dev] RE: PySequence_Contains (original) (raw)
Tim Peters tim.one@home.com
Sat, 5 May 2001 17:53:51 -0400
- Previous message: [Python-Dev] RE: PySequence_Contains
- Next message: [Python-Dev] multiple inheritance -- what I meant
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Guido]
... Surely you knew that "x in y" looped over the items of y? What else could it have done? It was only defined on sequences!
What's a sequence ? I expect I assumed that enduring a Python method call for every element of an instance was so expensive that Python didn't bother implementing "in" for instances (just for builtin sequences like lists and strings etc). I know I assumed it was so expensive that I never tried it (indeed, I doubt I've used "[not] in" on any sort of sequence excepting "if x in s" where s was a tuple, list or string of length no more than 4; for anything bigger I always used a dict or bisect). So it's a personal blind spot likely due to never looking in that direction.
- Previous message: [Python-Dev] RE: PySequence_Contains
- Next message: [Python-Dev] multiple inheritance -- what I meant
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]