Paul Rubin <no.email@nospam.invalid> writes: > Ben Bacarisse <ben.use...@bsb.me.uk> writes: >> c = sys.stdin.read(1) >> while c == ' ': >> c = sys.stdin.read(1)
(for the record: I was not suggesting this was how you'd do it but how you'd be forced to do it in some languages) > c = itertools.dropwhile( > lambda c: c==' ', > iter(lambda: sys.stdin.read(1),None) > ).next() Did you mean c = next(itertools.dropwhile(lambda c: c==' ', iter(lambda: sys.stdin.read(1), None))) ? I get "AttributeError: 'itertools.dropwhile' object has no attribute 'next'" from your example. Coming from the lazy language Haskell, I find your example natural (though the syntax is a little busy for my taste) but would it be considered Pythonic? -- Ben. -- https://mail.python.org/mailman/listinfo/python-list