[Python-ideas] [Python-Dev] minmax() function returning (minimum, maximum) tuple of a sequence

Paul Moore p.f.moore at gmail.com
Tue Oct 12 22:33:01 CEST 2010

On 12 October 2010 20:41, Tal Einat <taleinat at gmail.com> wrote:
> That's what I was thinking about too.
> How about something along these lines?
> http://pastebin.com/DReBL56T
> I just worked that up now and would like some comments and
> suggestions. It could either turn into a PEP or an external library,
> depending on popularity here.

Looks reasonable. I'd suspect it would be more appropriate as an
external library rather than going directly into the stdlib. Also,
when I've needed something like this in the past (for simulation code,
involving iterators with millions of entries) speed has been pretty
critical, so something pure-python like this might not have been
enough. Maybe it's something that would be appropriate for numpy?

But I like the idea in general. I don't see the need for the
RunningCalc base class (duck typing rules!) and I'd be tempted to add
dummy close methods, to conform to the published consumer protocol
(even though it's not a formal Python standard). I wouldn't
necessarily use the given apply function, either, but that's a matter
of taste (I would suggest you change the name, though, to avoid
reusing the old apply builtin's name, which was something entirely


More information about the Python-ideas mailing list