Issue 14451: sum, min, max only works with iterable (original) (raw)
Issue14451
Created on 2012-03-30 10:18 by Fade78, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Messages (2) | ||
---|---|---|
msg157133 - (view) | Author: (Fade78) | Date: 2012-03-30 10:18 |
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): totalsum+=sum(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. | ||
msg157137 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2012-03-30 14:21 |
The current behavior is how we want the functions to work. If you want to debate the design, the best forum would probably be python-ideas. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:28 | admin | set | github: 58656 |
2012-03-30 14:21:58 | r.david.murray | set | status: open -> closednosy: + r.david.murraymessages: + resolution: rejectedstage: resolved |
2012-03-30 10🔞26 | Fade78 | create |