Range Operation pre-PEP

Andrew Henshaw andrew_dot_henshaw_at_earthling_dot_net
Wed May 16 22:17:56 EDT 2001


"Christopher A. Craig" <com-nospam at ccraig.org> wrote in message
news:871ypp8p0s.fsf at elbereth.ccraig.org...
> Greg Ewing <see at my.signature> writes:
>
> > Tim Peters wrote:
> > >
> > > For an extreme example, max(sys.stdin)
> >
> > Ha! I like it! I can just imagine a professor setting
> > an assignment which says "Read characters from standard
> > input up to EOF and return the one with the highest
> > ASCII value" and some smart-alec student hands in
> > a one-line Python solution.
> >
>
> Umm, you can do that now:
> reduce(max, sys.stdin.read())
>

Is there a reason that you need the 'reduce'?

    max(sys.stdin.read())

should work.





More information about the Python-list mailing list