On 2017-04-18 02:09, Paul Rubin wrote:
Ben Bacarisse <ben.use...@bsb.me.uk> writes:
? I get "AttributeError: 'itertools.dropwhile' object has no attribute
'next'" from your example.
Hmm, .next() worked ok for me in Python 2.7.5. Not sure what happened.
Maybe something went wrong with my paste. Oh well.
Coming from the lazy language Haskell, I find your example natural...
Yep ;)
Your mistake was that you didn't say it was Python 2. :-)
In Python 3 it's:
c = next(itertools.dropwhile(
lambda c: c==' ',
iter(lambda: sys.stdin.read(1),None)
))
--
https://mail.python.org/mailman/listinfo/python-list