Last iteration?
Paul Hankin
paul.hankin at gmail.com
Thu Oct 18 03:52:57 EDT 2007
More information about the Python-list mailing list
Thu Oct 18 03:52:57 EDT 2007
- Previous message (by thread): Last iteration?
- Next message (by thread): Last iteration?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Oct 17, 11:45 pm, Raymond Hettinger <pyt... at rcn.com> wrote: > [Paul Hankin] > > > def lastdetector(iterable): > > t, u = tee(iterable) > > return izip(chain(imap(lambda x: False, islice(u, 1, None)), > > [True]), t) > > Sweet! Nice, clean piece of iterator algebra. > > We need a C-speed verion of the lambda function, something like a K > combinator that consumes arguments and emits constants. Perhaps, but I think you'll need a better use-case than this :) Actually, would a c-version be much faster? -- Paul Hankin
- Previous message (by thread): Last iteration?
- Next message (by thread): Last iteration?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list