New submission from Fade78 <[email protected]>:
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.
----------
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 <[email protected]>
<http://bugs.python.org/issue14451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com