[issue14451] sum, min, max only works with iterable

Fade78 report at bugs.python.org
Fri Mar 30 12:18:26 CEST 2012

New submission from Fade78 <fade at wanadoo.fr>:

The built-in functions working with iterable should also work with single object that is relevent.

For example:
max([1,6,5]) -> 6
max(6) -> TypeError because not an iterable (actual behavior)
max(6) -> 6 (wanted pythonic behavior)

So if I write a generic function like this:

def f(x):

it fails if x is not an iterable. But I want the argument to be anything possible. Using if(type) to separate use cases is not very pythonic.

components: None
messages: 157133
nosy: Fade78
priority: normal
severity: normal
status: open
title: sum, min, max only works with iterable
type: behavior
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list