Hacker News new | ask | show | jobs
by eesmith 2306 days ago
FWIW, iter() handles the logic of testing for an explicit EOF marker, so another way to write it is:

    import sys

    with open(sys.argv[1]) as fin:
        for c in iter((lambda: fin.read(1)), ""):
            sys.stdout.write(c)
1 comments

That's a good point. Thanks!