News for hackers. Stuff that matters.
Re:Show HN: A simple Unix cat implementation in various lang... by eesmith on Sunday March 01, 2020 @12:39AM (#22455324)
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)
Re:Show HN: A simple Unix cat implementation in various lang... by rspivak on Sunday March 01, 2020 @06:43AM (#22456450)
That's a good point. Thanks!