Proposed new collection methods
spam.csubich+block at block.subich.spam.com
Sun Aug 7 06:53:00 CEST 2005
Robert Kern wrote:
> Jeff Schwab wrote:
>> Why are you retarded? Isn't the above code O(n)?
>> Forgive me for not understanding, I'm still awfully new to Python
>> (having come from Perl & C++), and I didn't see an explanation in the
> (s for s in iter(self) is test(s)) is a generator expression. It is
> roughly equivalent to
> That implementation does indeed return as soon as it locates the first
> item, so yes, I was being retarded.
Thank you for the best programming-language related laugh I've had
today. :) I know just the kind of synapse-misfires that lead to
completely obvious, yet also completely wrong conclusions like that --
I've done well more than my own share.
For the grandparent poster: generators and its baby brother generator
expressions are the kind of really neat feature that you're never told
about in CS101. Generators themselves are relatively well-covered in
the Python documentation, which should serve as a decent introduction to
More information about the Python-list