The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)
Chris Angelico
rosuav at gmail.com
Tue Mar 22 09:00:25 EDT 2016
More information about the Python-list mailing list
Tue Mar 22 09:00:25 EDT 2016
- Previous message (by thread): The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)
- Next message (by thread): The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Mar 22, 2016 at 11:52 PM, Jussi Piitulainen <jussi.piitulainen at helsinki.fi> wrote: > Now you can ask for the next item that satisfies a condition using a > generator expression: > > next(symbol for symbol in stream if not symbol.isspace()) > ---> '/' > > next(symbol for symbol in stream if not symbol.isspace()) > ---> '*' Or use filter(), which is sometimes clearer: # You probably want a more sophisticated function here def nonspace(ch): return not ch.isspace() next(filter(nonspace, stream)) ChrisA
- Previous message (by thread): The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)
- Next message (by thread): The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list