Hacker News new | ask | show | jobs
by rspivak 2306 days ago
Feel free to add your own implementation. :)
1 comments

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)
That's a good point. Thanks!